Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions .idea/dictionaries/Javier_Alonso_Silva.xml

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/modules.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.

5 changes: 3 additions & 2 deletions app/build.gradle
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "javinator9889.bitcoinpools"
minSdkVersion 21
targetSdkVersion 27
versionCode 4
versionName "1.12"
versionCode 14
versionName "1.15"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -50,4 +50,5 @@ dependencies {
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.jpardogo.materialtabstrip:library:1.1.1'
}
Binary file added app/release/BitCoinPools-1.15.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":6},"path":"app-release.apk","properties":{"packageId":"javinator9889.bitcoinpools","split":"","minSdkVersion":"21"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":14},"path":"app-release.apk","properties":{"packageId":"javinator9889.bitcoinpools","split":"","minSdkVersion":"21"}}]
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Expand Up @@ -13,7 +13,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/CustomTheme"
android:name=".BitCoinApp">
<activity
android:name=".MainActivity"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/javinator9889/bitcoinpools/BitCoinApp.java
Expand Up @@ -10,7 +10,6 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.util.Log;

Expand All @@ -25,7 +24,7 @@
* Based on: https://github.com/ZonaRMR/SimpleForFacebook/blob/master/app/src/main/java/com/creativetrends/simple/app/activities/SimpleApp.java
*/
@ReportsCrashes(
mailTo = "YOUR_MAIL",
mailTo = "javialonso007@hotmail.es",
mode = ReportingInteractionMode.DIALOG,
resDialogText = R.string.crash,
logcatArguments = {"-t", "200", "-v", "long"}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/javinator9889/bitcoinpools/Constants.java
Expand Up @@ -25,8 +25,8 @@ public static final class SHARED_PREFERENCES {
public static final String CHANNEL_ID = "javinator9889.bitcoinpools.Alerts";
public static final int NOTIFICATION_ID = 1;
public static final int REQUEST_CODE = 0;
public static final String GITHUB_USER = "GITHUB_USER";
public static final String GITHUB_REPO = "GITHUB_REPO";
public static final String GITHUB_USER = "Javinator9889";
public static final String GITHUB_REPO = "BitCoinPools";
public static final String STATS_URL = "https://api.blockchain.info/stats";
public static final String MARKET_NAME = "market_price_usd";
public static final String POOLS_URL = "https://api.blockchain.info/pools?timespan=";
Expand Down
@@ -0,0 +1,134 @@
package javinator9889.bitcoinpools.FragmentViews;

import android.annotation.SuppressLint;
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.TextView;

import com.afollestad.materialdialogs.MaterialDialog;

import java.util.List;

import javinator9889.bitcoinpools.R;

/**
* Created by Javinator9889 on 31/01/2018.
* Based on: https://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/
*/

public class CardsAdapter extends RecyclerView.Adapter<CardsAdapter.MyViewHolder> {
private Context context;
private List<CardsContent> btcData;

public class MyViewHolder extends RecyclerView.ViewHolder {
TextView title, body;
View v;

MyViewHolder(View view) {
super(view);
title = view.findViewById(R.id.title_text);
body = view.findViewById(R.id.body_text);
this.v = view;
}
}

CardsAdapter(Context context, List<CardsContent> btcData) {
this.context = context;
this.btcData = btcData;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.bitcoin_card, parent, false);
return new MyViewHolder(itemView);
}

@Override
public void onBindViewHolder(final MyViewHolder holder, @SuppressLint("RecyclerView") final int position) {
final CardsContent content = btcData.get(position);
holder.title.setText(content.getTitle());
holder.body.setText(content.getBody());
holder.v.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
switch (position) {
case 0:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.market_price))
.content(R.string.market_price_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 1:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.hash_rate))
.content(R.string.hash_rate_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 2:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.difficulty))
.content(R.string.difficulty_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 3:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.min_blocks))
.content(R.string.min_blocks_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 4:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.minutes_blocks))
.content(R.string.minutes_blocks_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 5:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.total_fees))
.content(R.string.total_fees_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 6:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.total_trans))
.content(R.string.total_trans_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
case 7:
new MaterialDialog.Builder(context)
.title(context.getString(R.string.min_benefit))
.content(R.string.min_benefit_desc, true)
.cancelable(true)
.positiveText(R.string.accept)
.build().show();
break;
default:
break;
}
return false;
}
});
}

@Override
public int getItemCount() {
return btcData.size();
}
}
@@ -0,0 +1,24 @@
package javinator9889.bitcoinpools.FragmentViews;

/**
* Created by Javinator9889 on 31/01/2018.
* Simple class containing cards information
*/

public class CardsContent {
private String title;
private String body;

public CardsContent(String title, String body) {
this.title = title;
this.body = body;
}

public String getBody() {
return body;
}

public String getTitle() {
return title;
}
}
@@ -0,0 +1,47 @@
package javinator9889.bitcoinpools.FragmentViews;

import android.content.Context;
import android.widget.TextView;

import com.github.mikephil.charting.components.MarkerView;
import com.github.mikephil.charting.data.CandleEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.utils.MPPointF;
import com.github.mikephil.charting.utils.Utils;

import javinator9889.bitcoinpools.R;

/**
* Created by Javinator9889 on 29/01/2018.
* Based on: https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyMarkerView.java
*/

public class CustomMarkerView extends MarkerView {

private TextView tvContent;

public CustomMarkerView(Context context, int layoutResource) {
super(context, layoutResource);

tvContent = findViewById(R.id.tvContent);
}

// callbacks everytime the MarkerView is redrawn, can be used to update the
// content (user-interface)
@Override
public void refreshContent(Entry e, Highlight highlight) {
if (e instanceof CandleEntry) {
CandleEntry ce = (CandleEntry) e;
tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
} else {
tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
}
super.refreshContent(e, highlight);
}

@Override
public MPPointF getOffset() {
return new MPPointF(-(getWidth() / 2), -getHeight());
}
}