Browse Source

Test commit

rivetz
Gutyn 9 years ago
parent
commit
6dbdc9a56f
  1. 1308
      .idea/workspace.xml
  2. 7
      app/build.gradle
  3. 5
      app/src/main/AndroidManifest.xml
  4. 43
      app/src/main/java/com/breadwallet/presenter/BreadWalletApp.java
  5. 3
      app/src/main/java/com/breadwallet/presenter/activities/IntroActivity.java
  6. 319
      app/src/main/java/com/breadwallet/presenter/activities/MainActivity.java
  7. 43
      app/src/main/java/com/breadwallet/presenter/fragments/MainFragment.java
  8. 84
      app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentDecoder.java
  9. 31
      app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentQR.java
  10. 19
      app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentSettingsAll.java
  11. 52
      app/src/main/java/com/breadwallet/presenter/fragments/allsettings/FragmentSettings.java
  12. 81
      app/src/main/java/com/breadwallet/presenter/fragments/allsettings/settings/FragmentCurrency.java
  13. 8
      app/src/main/java/com/breadwallet/tools/adapter/CustomPagerAdapter.java
  14. 41
      app/src/main/java/com/breadwallet/tools/adapter/ParallaxViewPager.java
  15. 107
      app/src/main/java/com/breadwallet/tools/animation/FragmentAnimator.java
  16. 16
      app/src/main/java/com/breadwallet/tools/animation/SpringAnimator.java
  17. 113
      app/src/main/java/com/breadwallet/tools/others/CurrencyManager.java
  18. 58
      app/src/main/java/com/breadwallet/tools/others/JsonParser.java
  19. 86
      app/src/main/java/com/breadwallet/tools/others/MyClipboardManager.java
  20. 6
      app/src/main/java/com/breadwallet/tools/qrcode/QRCodeEncoder.java
  21. 10
      app/src/main/java/com/breadwallet/tools/qrcode/QRCodeReaderView.java
  22. 3
      app/src/main/res/drawable-hdpi/button.xml
  23. 20
      app/src/main/res/layouts/activities/layout/activity_main.xml
  24. 167
      app/src/main/res/layouts/fragments/layout/fragment_about.xml
  25. 29
      app/src/main/res/layouts/fragments/layout/fragment_decoder.xml
  26. 123
      app/src/main/res/layouts/fragments/layout/fragment_local_currency.xml
  27. 67
      app/src/main/res/layouts/fragments/layout/fragment_main.xml
  28. 11
      app/src/main/res/layouts/fragments/layout/fragment_settings.xml
  29. 1
      app/src/main/res/layouts/fragments/layout/fragmentqr_main.xml
  30. 17
      app/src/main/res/layouts/layout/currency_list_item.xml
  31. 2
      app/src/main/res/values/colors.xml
  32. BIN
      captures/Snapshot_2015.07.15_14.14.21.hprof
  33. BIN
      captures/Snapshot_2015.07.15_14.14.39.hprof
  34. BIN
      captures/Snapshot_2015.07.15_14.27.28.hprof
  35. BIN
      captures/Snapshot_2015.07.15_14.27.43.hprof
  36. BIN
      captures/Snapshot_2015.07.15_14.28.00.hprof

1308
.idea/workspace.xml

File diff suppressed because it is too large

7
app/build.gradle

@ -21,8 +21,8 @@ android {
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java','.apt_generated']
aidl.srcDirs = ['src/main/aidl','.apt_generated']
java.srcDirs = ['src/main/java', '.apt_generated']
aidl.srcDirs = ['src/main/aidl', '.apt_generated']
assets.srcDirs = ['src/main/assets']
res.srcDirs =
[
@ -40,6 +40,7 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.zxing:core:3.2.0'
compile 'com.google.zxing:core:3.2.0' //QRCode scanner
compile 'com.facebook.rebound:rebound:0.3.8' //spring animation
compile 'org.json:json:20141113' //JSonParser google
}

5
app/src/main/AndroidManifest.xml

@ -5,12 +5,15 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name="com.breadwallet.presenter.BreadWalletApp"
android:allowBackup="true"
android:icon="@mipmap/icon80"
android:label="@string/app_name"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:largeHeap="true"> >
<activity
android:name=".presenter.activities.IntroActivity"
android:label="@string/app_name"

43
app/src/main/java/com/breadwallet/presenter/BreadWalletApp.java

@ -1,7 +1,48 @@
package com.breadwallet.presenter;
import android.app.Activity;
import android.app.Application;
import android.os.Handler;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.breadwallet.R;
/**
* Created by Mihail on 7/22/15.
*/
public class BreadWalletApp {
public class BreadWalletApp extends Application {
public static final String TAG = "BreadWalletApp";
private boolean customToastAvailable = true;
/**
* Shows a custom toast using the given string as a paramater,
*
* @param message the message to be shown in the custom toast
*/
public void showCustomToast(Activity app, String message, int yOffSet, int duration) {
if (customToastAvailable) {
customToastAvailable = false;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
customToastAvailable = true;
}
}, 1000);
LayoutInflater inflater = app.getLayoutInflater();
View layout = inflater.inflate(R.layout.toast,
(ViewGroup) app.findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.toast_text);
text.setText(message);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.BOTTOM, 0, yOffSet);
toast.setDuration(duration);
toast.setView(layout);
toast.show();
}
}
}

3
app/src/main/java/com/breadwallet/presenter/activities/IntroActivity.java

@ -4,7 +4,6 @@ import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.breadwallet.R;
@ -27,7 +26,7 @@ public class IntroActivity extends Activity {
startActivity(intent);
finish();
}
}, 3000);
}, 800);
}
}

319
app/src/main/java/com/breadwallet/presenter/activities/MainActivity.java

@ -1,27 +1,27 @@
package com.breadwallet.presenter.activities;
import android.content.ClipboardManager;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.breadwallet.R;
import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.presenter.fragments.MainFragmentDecoder;
import com.breadwallet.presenter.fragments.MainFragmentSettings;
import com.breadwallet.presenter.fragments.MainFragmentSettingsPressed;
import com.breadwallet.tools.adapter.MyPagerAdapter;
import com.breadwallet.presenter.fragments.MainFragmentSettingsAll;
import com.breadwallet.presenter.fragments.allsettings.FragmentSettings;
import com.breadwallet.presenter.fragments.allsettings.settings.FragmentAbout;
import com.breadwallet.presenter.fragments.allsettings.settings.FragmentCurrency;
import com.breadwallet.tools.adapter.CustomPagerAdapter;
import com.breadwallet.tools.adapter.ParallaxViewPager;
import com.breadwallet.tools.animations.SpringAnimator;
import com.breadwallet.tools.animation.FragmentAnimator;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.tools.others.CurrencyManager;
import java.util.HashMap;
import java.util.Map;
@ -29,20 +29,22 @@ import java.util.Map;
public class MainActivity extends FragmentActivity {
public static final String TAG = "MainActivity";
private static MainActivity app;
public static final String PREFS_NAME = "MyPrefsFile";
public static boolean decoderFragmentOn;
private boolean onBackPressedAvailable = true;
private boolean doubleBackToExitPressedOnce;
private boolean settingsON;
private boolean settingsPressedOn;
private boolean settingsAvailable = true;
private boolean decoderFragmentOn;
private MyPagerAdapter pagerAdapter;
private CustomPagerAdapter pagerAdapter;
private ImageView pageIndicator;
private Map<String, Integer> indicatorMap;
private Button burgerButton;
private MainFragmentSettings mainFragmentSettings;
private MainFragmentSettingsAll mainFragmentSettingsAll;
private ParallaxViewPager parallaxViewPager;
private MainFragmentSettingsPressed mainFragmentSettingsPressed;
private FragmentSettings fragmentSettings;
private FragmentAbout fragmentAbout;
private MainFragmentDecoder mainFragmentDecoder;
private ClipboardManager myClipboard;
private FragmentCurrency fragmentCurrency;
/**
* Public constructor used to assign the current instance to the app variable
@ -58,9 +60,30 @@ public class MainActivity extends FragmentActivity {
initializeViews();
SpringAnimator.showAnimation(burgerButton);
myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
}
@Override
protected void onResume() {
super.onResume();
CurrencyManager.startTimer();
}
@Override
protected void onStop() {
super.onStop();
CurrencyManager.stoptimertask();
}
@Override
protected void onDestroy() {
super.onDestroy();
MainFragmentDecoder.getMainFragmentDecoder().stopCamera();
Log.e(TAG, "Activity Destroyed!");
}
/**
* Initializes all the views and components
*/
@ -68,95 +91,27 @@ public class MainActivity extends FragmentActivity {
burgerButton = (Button) findViewById(R.id.mainbuttonburger);
Log.d(TAG, "The burger button's id: " + burgerButton.getId());
pageIndicator = (ImageView) findViewById(R.id.pagerindicator);
pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
pagerAdapter = new CustomPagerAdapter(getSupportFragmentManager());
indicatorMap = new HashMap<>();
mainFragmentSettings = new MainFragmentSettings();
mainFragmentSettingsPressed = new MainFragmentSettingsPressed();
fragmentSettings = new FragmentSettings();
mainFragmentSettingsAll = new MainFragmentSettingsAll();
mainFragmentDecoder = new MainFragmentDecoder();
fragmentAbout = new FragmentAbout();
fragmentCurrency = new FragmentCurrency();
parallaxViewPager = ((ParallaxViewPager) findViewById(R.id.pager));
parallaxViewPager
.setOverlapPercentage(0.99f)
.setAdapter(pagerAdapter);
parallaxViewPager.setBackgroundResource(R.drawable.backgroundmain);
indicatorMap.put("left", R.drawable.pageindicatorleft);
indicatorMap.put("right", R.drawable.pageindicatorright);
}
/**
* Animate the transition on burgerButton/MenuButton pressed
*/
public void animateSettingsFragment() {
if (settingsAvailable) {
Log.d(TAG, "Inside the animateSettingsFragment!");
settingsAvailable = false;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
settingsAvailable = true;
}
}, 300);
if (!settingsON) {
if (!settingsPressedOn) {
settingsON = true;
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_bottom, R.animator.from_bottom);
fragmentTransaction.replace(R.id.mainlayout, mainFragmentSettings);
fragmentTransaction.commit();
pagerAdapter.showFragments(false);
pageIndicator.setVisibility(View.GONE);
} else {
animateSettingsPressed();
}
} else {
settingsON = false;
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.to_bottom, R.animator.to_bottom);
fragmentTransaction.remove(mainFragmentSettings);
fragmentTransaction.commit();
pagerAdapter.showFragments(true);
pageIndicator.setVisibility(View.VISIBLE);
}
}
}
/**
* Animates the fragment transition on button "Settings" pressed
*/
public void animateSettingsPressed() {
if (!settingsPressedOn) {
settingsPressedOn = true;
settingsON = false;
//Disabled inspection: <Expected resource type anim>
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_right, R.animator.to_left);
fragmentTransaction.replace(R.id.mainlayout, mainFragmentSettingsPressed);
fragmentTransaction.commit();
} else {
settingsON = true;
settingsPressedOn = false;
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_left, R.animator.to_right);
fragmentTransaction.replace(R.id.mainlayout, mainFragmentSettings);
fragmentTransaction.commit();
}
}
public void animateDecoderFragment() {
decoderFragmentOn = true;
//Disabled inspection: <Expected resource type anim>
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_bottom, R.animator.to_top);
fragmentTransaction.replace(R.id.mainlayout, mainFragmentDecoder);
fragmentTransaction.commit();
Log.e(TAG, "The mainFragmentDecoder: " + mainFragmentDecoder);
Log.e(TAG, "The fragmentTransaction: " + fragmentTransaction);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU) {
animateSettingsFragment();
FragmentAnimator.pressMenuButton(app);
// return 'true' to prevent further propagation of the key event
return true;
}
@ -165,52 +120,42 @@ public class MainActivity extends FragmentActivity {
return super.onKeyDown(keyCode, event);
}
/**
* Shows a custom toast using the given string as a paramater,
*
* @param message the message to be shown in the custom toast
*/
public void showCustomToast(String message) {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast,
(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.toast_text);
text.setText(message);
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.BOTTOM, 0, 100);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(layout);
toast.show();
}
@Override
public void onBackPressed() {
if (!settingsPressedOn) {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
if (settingsON) {
animateSettingsFragment();
}
if (decoderFragmentOn) {
decoderFragmentOn = false;
getSupportFragmentManager().beginTransaction().
remove(mainFragmentDecoder).commit();
if (onBackPressedAvailable) {
onBackPressedAvailable = false;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
onBackPressedAvailable = true;
}
}, 300);
if (FragmentAnimator.level == 0) {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
if (decoderFragmentOn) {
decoderFragmentOn = false;
getSupportFragmentManager().beginTransaction().
remove(mainFragmentDecoder).commit();
CustomPagerAdapter.getAdapter().showFragments(true);
} else {
this.doubleBackToExitPressedOnce = true;
((BreadWalletApp) getApplicationContext()).showCustomToast(this,
"Press again to exit!", 100, Toast.LENGTH_SHORT);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce = false;
}
}, 1000);
}
} else if (FragmentAnimator.level == 1) {
FragmentAnimator.pressMenuButton(this);
} else {
this.doubleBackToExitPressedOnce = true;
showCustomToast("Press again to exit!");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce = false;
}
}, 1000);
FragmentAnimator.animateSlideToRight(this);
}
} else {
animateSettingsPressed();
}
}
@ -227,17 +172,111 @@ public class MainActivity extends FragmentActivity {
}
/**
* @return the singleton instance of the MainActivity class
* GETTERS AND SETTERS
*/
public FragmentSettings getFragmentSettings() {
return fragmentSettings;
}
public static MainActivity getApp() {
return app;
}
/**
* @return the current instance of the class MainFragmentSettingsPressed
*/
public MainFragmentSettingsPressed getMainFragmentSettingsPressed() {
return mainFragmentSettingsPressed;
public void setDecoderFragmentOn(boolean decoderFragmentOn) {
this.decoderFragmentOn = decoderFragmentOn;
}
public void setMainFragmentDecoder(MainFragmentDecoder mainFragmentDecoder) {
this.mainFragmentDecoder = mainFragmentDecoder;
}
public static void setApp(MainActivity app) {
MainActivity.app = app;
}
public Button getBurgerButton() {
return burgerButton;
}
public void setBurgerButton(Button burgerButton) {
this.burgerButton = burgerButton;
}
public boolean isDecoderFragmentOn() {
return decoderFragmentOn;
}
public boolean isDoubleBackToExitPressedOnce() {
return doubleBackToExitPressedOnce;
}
public void setDoubleBackToExitPressedOnce(boolean doubleBackToExitPressedOnce) {
this.doubleBackToExitPressedOnce = doubleBackToExitPressedOnce;
}
public Map<String, Integer> getIndicatorMap() {
return indicatorMap;
}
public void setIndicatorMap(Map<String, Integer> indicatorMap) {
this.indicatorMap = indicatorMap;
}
public MainFragmentDecoder getMainFragmentDecoder() {
return mainFragmentDecoder;
}
public MainFragmentSettingsAll getMainFragmentSettingsAll() {
return mainFragmentSettingsAll;
}
public void setMainFragmentSettingsAll(MainFragmentSettingsAll mainFragmentSettingsAll) {
this.mainFragmentSettingsAll = mainFragmentSettingsAll;
}
public void setFragmentSettings(FragmentSettings fragmentSettings) {
this.fragmentSettings = fragmentSettings;
}
public ImageView getPageIndicator() {
return pageIndicator;
}
public void setPageIndicator(ImageView pageIndicator) {
this.pageIndicator = pageIndicator;
}
public CustomPagerAdapter getPagerAdapter() {
return pagerAdapter;
}
public void setPagerAdapter(CustomPagerAdapter pagerAdapter) {
this.pagerAdapter = pagerAdapter;
}
public ClipboardManager getMyClipboard() {
return myClipboard;
}
public void setMyClipboard(ClipboardManager myClipboard) {
this.myClipboard = myClipboard;
}
public FragmentAbout getFragmentAbout() {
return fragmentAbout;
}
public void setFragmentAbout(FragmentAbout fragmentAbout) {
this.fragmentAbout = fragmentAbout;
}
public FragmentCurrency getFragmentCurrency() {
return fragmentCurrency;
}
public void setFragmentCurrency(FragmentCurrency fragmentCurrency) {
this.fragmentCurrency = fragmentCurrency;
}
}

43
app/src/main/java/com/breadwallet/presenter/fragments/MainFragment.java

@ -1,14 +1,21 @@
package com.breadwallet.presenter.fragments;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.adapter.CustomPagerAdapter;
import com.breadwallet.tools.animation.FragmentAnimator;
import com.breadwallet.tools.others.MyClipboardManager;
/**
* The main fragment shown in the MainActivity
@ -16,8 +23,9 @@ import com.breadwallet.presenter.activities.MainActivity;
public class MainFragment extends Fragment {
public static final String TAG = "MainFragment";
private Button scanQRButton;
// private Button payAddressFromClipboardButton;
private Button payAddressFromClipboardButton;
private MainActivity mainActivity;
private EditText addressEditText;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -31,14 +39,41 @@ public class MainFragment extends Fragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
scanQRButton = (Button) getActivity().findViewById(R.id.mainbuttonscanqrcode);
// payAddressFromClipboardButton = (Button) getActivity().findViewById(R.id.mainbuttonpayaddressfromclipboard);
mainActivity = (MainActivity) getActivity();
payAddressFromClipboardButton = (Button) getActivity().findViewById(R.id.mainbuttonpayaddressfromclipboard);
mainActivity = MainActivity.getApp();
scanQRButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mainActivity.animateDecoderFragment();
FragmentAnimator.animateDecoderFragment();
CustomPagerAdapter.getAdapter().showFragments(false);
}
});
addressEditText = (EditText) getView().findViewById(R.id.addresseditText);
addressEditText.setGravity(Gravity.CENTER_HORIZONTAL);
addressEditText.setShowSoftInputOnFocus(false);
payAddressFromClipboardButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
payAddressFromClipboardButton.setBackgroundResource(R.drawable.buttonbluepressed);
addressEditText.setText(MyClipboardManager.readFromClipboard(getActivity()));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
payAddressFromClipboardButton.setBackgroundResource(R.drawable.buttonblue);
}
}, 50);
break;
}
return false;
}
});
}
public EditText getAddressEditText() {
return addressEditText;
}
}

84
app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentDecoder.java

@ -4,32 +4,31 @@ import android.content.Intent;
import android.graphics.PointF;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.ScanResultActivity;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.tools.qrcode.QRCodeReaderView;
public class MainFragmentDecoder extends Fragment implements QRCodeReaderView.OnQRCodeReadListener {
public static final String TAG = "DecoderActivity";
public static final String TAG = "MainFragmentDecoder";
private boolean accessGranted = true;
private TextView myTextView;
private QRCodeReaderView mydecoderview;
private ImageView line_image;
private static QRCodeReaderView mydecoderview;
private ImageView camera_guide_image;
private Intent intent;
private MainFragmentDecoder decoderFragment;
private static MainFragmentDecoder decoderFragment;
private RelativeLayout layout;
public MainFragmentDecoder() {
@ -44,33 +43,36 @@ public class MainFragmentDecoder extends Fragment implements QRCodeReaderView.On
intent = new Intent(getActivity(), ScanResultActivity.class);
myTextView = (TextView) rootView.findViewById(R.id.exampleTextView);
line_image = (ImageView) rootView.findViewById(R.id.red_line_image);
TranslateAnimation mAnimation = new TranslateAnimation(
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.ABSOLUTE, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0f,
TranslateAnimation.RELATIVE_TO_PARENT, 0.5f);
mAnimation.setDuration(1000);
mAnimation.setRepeatCount(-1);
mAnimation.setRepeatMode(Animation.REVERSE);
mAnimation.setInterpolator(new LinearInterpolator());
line_image.setAnimation(mAnimation);
camera_guide_image = (ImageView) rootView.findViewById(R.id.camera_guide_image);
SpringAnimator.showExpandCameraGuide(camera_guide_image);
// Inflate the layout for this fragment
return rootView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
layout = (RelativeLayout) getView().findViewById(R.id.fragment_decoder_layout);
mydecoderview = new QRCodeReaderView(getActivity().getApplicationContext());
mydecoderview.setOnQRCodeReadListener(decoderFragment);
if (mydecoderview != null)
mydecoderview.getCameraManager().startPreview();
mydecoderview.setVisibility(View.GONE);
}
/**
* Called when a QR is decoded
* "text" : the text encoded in QR
* "points" : points where QR control points are placed
*/
@Override
public void onQRCodeRead(String text, PointF[] points) {
synchronized (this) {
if (accessGranted) {
accessGranted = false;
myTextView.setText(text);
// Log.e(TAG, "Activity STARTED!!!!!");
intent.putExtra("result", text);
startActivity(intent);
@ -102,40 +104,46 @@ public class MainFragmentDecoder extends Fragment implements QRCodeReaderView.On
super.onPause();
Log.e(TAG, "In onPause");
mydecoderview.getCameraManager().stopPreview();
new ViewRemoverTask().execute();
layout.removeView(mydecoderview);
}
private class CameraOpenerTask extends AsyncTask {
@Override
protected Object doInBackground(Object[] params) {
layout = (RelativeLayout) getActivity().findViewById(R.id.fragment_decoder_layout);
return null;
}
@Override
protected void onPostExecute(Object o) {
mydecoderview = new QRCodeReaderView(getActivity().getApplicationContext());
mydecoderview.setOnQRCodeReadListener(decoderFragment);
mydecoderview.getCameraManager().startPreview();
layout.addView(mydecoderview);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
layout.addView(mydecoderview, 0);
mydecoderview.setVisibility(View.VISIBLE);
}
}, 1300);
Log.e(TAG, "The camera started");
}
}
private class ViewRemoverTask extends AsyncTask {
@Override
protected Object doInBackground(Object[] params) {
return null;
public void stopCamera() {
if (mydecoderview != null) {
mydecoderview.getCameraManager().stopPreview();
mydecoderview.getCameraManager().closeDriver();
}
mydecoderview = null;
@Override
protected void onPostExecute(Object o) {
layout.removeView(mydecoderview);
mydecoderview = null;
Log.e(TAG, "Removed everithing good!");
}
}
public static MainFragmentDecoder getMainFragmentDecoder() {
return decoderFragment;
}
public static QRCodeReaderView getMydecoderview() {
return mydecoderview;
}
}

31
app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentQR.java

@ -3,6 +3,7 @@ package com.breadwallet.presenter.fragments;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.Display;
import android.view.LayoutInflater;
@ -10,8 +11,12 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.breadwallet.R;
import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.tools.others.MyClipboardManager;
import com.breadwallet.tools.qrcode.Contents;
import com.breadwallet.tools.qrcode.QRCodeEncoder;
import com.google.zxing.BarcodeFormat;
@ -24,16 +29,38 @@ public class MainFragmentQR extends Fragment {
public static final String TAG = "MainFragmentQR";
private ImageView qrcode;
private static final String TEST_ADDRESS = "mhBmRiqosSHR9YnPTKc3xXcvhEcKtjet2p";
private TextView mainAddressText;
private boolean customToastAvailable = true;
private Bitmap bitmap;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
// The last two arguments ensure LayoutParams are inflated
// properly.
View rootView = inflater.inflate(
final View rootView = inflater.inflate(
R.layout.fragmentqr_main, container, false);
qrcode = (ImageView) rootView.findViewById(R.id.mainimageqrcode);
generateQR();
mainAddressText = (TextView) rootView.findViewById(R.id.mainaddresstext);
mainAddressText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String tmp = mainAddressText.getText().toString();
MyClipboardManager.copyToClipboard(getActivity(), tmp);
if (customToastAvailable) {
customToastAvailable = false;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
customToastAvailable = true;
}
}, 2000);
((BreadWalletApp) getActivity().getApplicationContext()).
showCustomToast(getActivity(), "Address copied to clipboard", 360, Toast.LENGTH_SHORT);
}
}
});
return rootView;
}
@ -53,7 +80,7 @@ public class MainFragmentQR extends Fragment {
BarcodeFormat.QR_CODE.toString(),
smallerDimension);
try {
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
bitmap = qrCodeEncoder.encodeAsBitmap();
qrcode.setImageBitmap(bitmap);
} catch (WriterException e) {

19
app/src/main/java/com/breadwallet/presenter/fragments/MainFragmentSettingsAll.java

@ -1,7 +1,6 @@
package com.breadwallet.presenter.fragments;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
@ -11,7 +10,7 @@ import android.widget.RelativeLayout;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.tools.animation.FragmentAnimator;
/**
* Created by Mihail on 6/29/15.
@ -21,6 +20,7 @@ public class MainFragmentSettingsAll extends Fragment {
private RelativeLayout settings;
private MainActivity app;
private MainFragmentSettingsAll mainMainFragmentSettingsAll;
@Override
public View onCreateView(LayoutInflater inflater,
@ -28,7 +28,7 @@ public class MainFragmentSettingsAll extends Fragment {
// The last two arguments ensure LayoutParams are inflated
// properly.
final View rootView = inflater.inflate(
R.layout.fragment_settings, container, false);
R.layout.fragment_settings_all, container, false);
return rootView;
}
@ -37,20 +37,13 @@ public class MainFragmentSettingsAll extends Fragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
app = MainActivity.getApp();
mainMainFragmentSettingsAll = this;
settings = (RelativeLayout) getView().findViewById(R.id.settings);
settings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
app.animateSideToLeft(app.getMainFragmentSettingsAll(), app.getMainFragmentSettingsPressed());
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Log.d(TAG, "Starting: showBouncySlide()");
SpringAnimator.showBouncySlide(MainActivity.getApp().getMainFragmentSettingsPressed().getView());
}
}, 200);
FragmentAnimator.animateSlideToLeft(app, app.getFragmentSettings(), mainMainFragmentSettingsAll);
Log.d(TAG, "Starting: showBouncySlide()");
}
});
}

52
app/src/main/java/com/breadwallet/presenter/fragments/allsettings/FragmentSettings.java

@ -1,23 +1,30 @@
package com.breadwallet.presenter.fragments.allsettings;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.animation.SpringAnimator;
import com.breadwallet.presenter.fragments.allsettings.settings.FragmentCurrency;
import com.breadwallet.tools.animation.FragmentAnimator;
/**
* Created by Mihail on 6/29/15.
*/
public class FragmentSettings extends Fragment {
public static final String TAG = "FragmentSettings";
private RelativeLayout about;
private RelativeLayout localCurrency;
private MainActivity app;
private FragmentSettings fragmentSettings;
private TextView currencyName;
@Override
public View onCreateView(LayoutInflater inflater,
@ -25,24 +32,39 @@ public class FragmentSettings extends Fragment {
// The last two arguments ensure LayoutParams are inflated
// properly.
View rootView = inflater.inflate(
R.layout.fragment_settings_pressed, container, false);
R.layout.fragment_settings, container, false);
return rootView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
app = MainActivity.getApp();
about = (RelativeLayout) rootView.findViewById(R.id.about);
fragmentSettings = this;
about = (RelativeLayout) getView().findViewById(R.id.about);
currencyName = (TextView) getView().findViewById(R.id.three_letters_currency);
SharedPreferences settings = getActivity().getSharedPreferences(MainActivity.PREFS_NAME, 0);
String tmp = settings.getString(FragmentCurrency.CURRENT_CURRENCY, "USD");
currencyName.setText(tmp);
localCurrency = (RelativeLayout) getView().findViewById(R.id.local_currency);
about.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
app.animateSideToLeft(app.getMainFragmentSettingsAll(), app.getFragmentAbout());
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(MainActivity.getApp().getFragmentAbout().getView());
}
}, 200);
FragmentAnimator.animateSlideToLeft(app, app.getFragmentAbout(), fragmentSettings);
}
});
return rootView;
localCurrency.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentAnimator.animateSlideToLeft(app, app.getFragmentCurrency(), fragmentSettings);
}
});
}
public void setCurrencyText(final String selectedCurrency) {
currencyName.setText(selectedCurrency);
Log.d(TAG, "in the setCurrencyText() and the selectedCurrency is: " + selectedCurrency);
Log.d(TAG, "after assigning the text is: " + currencyName.getText().toString());
}
}

81
app/src/main/java/com/breadwallet/presenter/fragments/allsettings/settings/FragmentCurrency.java

@ -1,7 +1,86 @@
package com.breadwallet.presenter.fragments.allsettings.settings;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.breadwallet.R;
import com.breadwallet.presenter.BreadWalletApp;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.animation.FragmentAnimator;
import com.breadwallet.tools.others.CurrencyManager;
/**
* Created by Mihail on 7/14/15.
*/
public class FragmentCurrency {
public class FragmentCurrency extends Fragment {
public static final String TAG = "FragmentCurrency";
public static final String CURRENT_CURRENCY = "currentCurrency";
private ListView currencyList;
private MainActivity app;
private Button currencyRefresh;
private TextView noInternetConnection;
private ArrayAdapter adapter;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
// The last two arguments ensure LayoutParams are inflated
// properly.
View rootView = inflater.inflate(
R.layout.fragment_local_currency, container, false);
app = MainActivity.getApp();
currencyList = (ListView) rootView.findViewById(R.id.currency_list_view);
currencyRefresh = (Button) rootView.findViewById(R.id.currencyRefresh);
noInternetConnection = (TextView) rootView.findViewById(R.id.noInternetConnectionText);
currencyRefresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter = CurrencyManager.getCurrencyAddapterIfReady();
tryAndSetAdapter();
}
});
adapter = CurrencyManager.getCurrencyAddapterIfReady();
tryAndSetAdapter();
currencyList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
TextView tmp = (TextView) view.findViewById(R.id.currency_item_text);
final String selectedCurrency = tmp.getText().toString();
SharedPreferences settings = getActivity().getSharedPreferences(MainActivity.PREFS_NAME, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString(CURRENT_CURRENCY, selectedCurrency.substring(0, 3));
editor.commit();
FragmentAnimator.animateSlideToRight(app);
Log.d(TAG, "Selected item's text: " + selectedCurrency);
}
});
return rootView;
}
public void tryAndSetAdapter() {
if (adapter.getCount() > 0) {
currencyList.setAdapter(adapter);
currencyRefresh.setVisibility(View.GONE);
noInternetConnection.setVisibility(View.GONE);
} else {
((BreadWalletApp) app.getApplicationContext()).showCustomToast(getActivity(), "No internet connection", 500, Toast.LENGTH_SHORT);
currencyRefresh.setVisibility(View.VISIBLE);
noInternetConnection.setVisibility(View.VISIBLE);
}
}
}

8
app/src/main/java/com/breadwallet/tools/adapter/CustomPagerAdapter.java

@ -91,4 +91,12 @@ public class CustomPagerAdapter extends FragmentPagerAdapter {
public View getFragmentViewByIndex(int index) {
return index == 0 ? main : mainQR;
}
public MainFragment getMainFragment() {
return mainFragment;
}
public MainFragmentQR getMainFragmentQR() {
return mainFragmentQR;
}
}

41
app/src/main/java/com/breadwallet/tools/adapter/ParallaxViewPager.java

@ -18,12 +18,12 @@ import android.util.AttributeSet;
import android.util.Log;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.animations.SpringAnimator;
import com.breadwallet.tools.animation.FragmentAnimator;
import com.breadwallet.tools.animation.SpringAnimator;
@SuppressLint("NewApi")
public class ParallaxViewPager extends ViewPager {
public static final String TAG = "ParallaxViewPager";
public static final int FIT_WIDTH = 0;
public static final int FIT_HEIGHT = 1;
@ -71,6 +71,7 @@ public class ParallaxViewPager extends ViewPager {
destination.left = (int) Math.floor((position + positionOffset - CORRECTION_PERCENTAGE) * getWidth());
destination.right = (int) Math.ceil((position + positionOffset + 1 + CORRECTION_PERCENTAGE) * getWidth());
invalidate();
Log.e(TAG, "The bitmap params: " + bitmap.getWidth() + " " + bitmap.getHeight());
}
if (secondOnPageChangeListener != null) {
@ -85,21 +86,29 @@ public class ParallaxViewPager extends ViewPager {
secondOnPageChangeListener.onPageSelected(position);
}
app.setPagerIndicator(position);
if (position == 1) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(getRootView());
}
}, 80);
if (FragmentAnimator.level == 0) {
if (position == 1) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(getRootView(), SpringAnimator.TO_RIGHT);
}
}, 80);
} else if (position == 0) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(getRootView(), SpringAnimator.TO_LEFT);
}
}, 80);
}
}
Log.e("AdapterParalax", "Showing animation!!!!!");
}
@Override
public void onPageScrollStateChanged(int state) {
if (secondOnPageChangeListener != null) {
@ -152,7 +161,10 @@ public class ParallaxViewPager extends ViewPager {
*/
@Override
public void setBackgroundResource(int resid) {
bitmap = BitmapFactory.decodeResource(getResources(), resid);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = true;
options.inTargetDensity = 100;
bitmap = BitmapFactory.decodeResource(getResources(), resid, options);
}
@ -240,7 +252,6 @@ public class ParallaxViewPager extends ViewPager {
canvas.drawBitmap(bitmap, source, destination, null);
}
public void addOnPageChangeListener(OnPageChangeListener listener) {
secondOnPageChangeListener = listener;
}

107
app/src/main/java/com/breadwallet/tools/animation/FragmentAnimator.java

@ -1,17 +1,30 @@
package com.breadwallet.tools.animation;
import android.content.Context;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.MainActivity;
import com.breadwallet.tools.adapter.CustomPagerAdapter;
import java.util.Stack;
/**
* Created by Mihail on 7/13/15.
*/
public class FragmentAnimator {
public static final String TAG = "FragmentAnimator";
private static final MainActivity APP = MainActivity.getApp();
public static final MainActivity APP = MainActivity.getApp();
public static boolean settingsAllON;
public static boolean settingsAvailable = true;
private static boolean animationAvailable = true;
public static int level = 0;
public static Stack<Fragment> previous = new Stack<>();
public static void animateDecoderFragment() {
APP.setDecoderFragmentOn(true);
@ -22,4 +35,96 @@ public class FragmentAnimator {
int temp = fragmentTransaction.commit();
Log.e(TAG, String.valueOf(temp));
}
/**
* Animate the transition on burgerButton/MenuButton pressed
*/
public static void pressMenuButton(MainActivity context) {
if (settingsAvailable) {
Log.d(TAG, "Inside the pressMenuButton!");
settingsAvailable = false;
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
settingsAvailable = true;
}
}, 300);
if (level == 0) {
level++;
FragmentTransaction fragmentTransaction = context.getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_bottom, R.animator.from_bottom);
fragmentTransaction.replace(R.id.mainlayout, context.getMainFragmentSettingsAll());
fragmentTransaction.commit();
CustomPagerAdapter.getAdapter().showFragments(false);
context.getPageIndicator().setVisibility(View.GONE);
InputMethodManager keyboard = (InputMethodManager) APP.
getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.hideSoftInputFromWindow(CustomPagerAdapter.getAdapter().
getMainFragment().getAddressEditText().getWindowToken(), 0);
} else if (level == 1) {
level--;
settingsAllON = false;
FragmentTransaction fragmentTransaction = context.getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.to_bottom, R.animator.to_bottom);
fragmentTransaction.remove(context.getMainFragmentSettingsAll());
fragmentTransaction.commit();
CustomPagerAdapter.getAdapter().showFragments(true);
context.getPageIndicator().setVisibility(View.VISIBLE);
}
}
}
/**
* Animates the fragment transition on button "Settings" pressed
*/
public static void animateSlideToLeft(MainActivity context, final Fragment to, Fragment previousFragment) {
if (animationAvailable) {
animationAvailable = false;
makeAnimationAvailable(300);
level++;
FragmentTransaction fragmentTransaction = context.getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_right, R.animator.to_left);
fragmentTransaction.replace(R.id.mainlayout, to);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(to.getView(), SpringAnimator.TO_RIGHT);
}
}, 200);
previous.add(previousFragment);
fragmentTransaction.commit();
Log.e(TAG, "The level is: " + level);
}
}
public static void animateSlideToRight(MainActivity context) {
if (animationAvailable) {
animationAvailable = false;
makeAnimationAvailable(300);
final Fragment tmp = previous.pop();
level--;
Log.e(TAG, "The actual SettingsFragment: " + tmp);
FragmentTransaction fragmentTransaction = context.getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(R.animator.from_left, R.animator.to_right);
fragmentTransaction.replace(R.id.mainlayout, tmp);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
SpringAnimator.showBouncySlide(tmp.getView(), SpringAnimator.TO_LEFT);
}
}, 200);
fragmentTransaction.commit();
Log.e(TAG, "The level is: " + level);
}
}
public static void makeAnimationAvailable(int delay) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
animationAvailable = true;
}
}, delay);
}
}

16
app/src/main/java/com/breadwallet/tools/animation/SpringAnimator.java

@ -1,7 +1,6 @@
package com.breadwallet.tools.animation;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@ -20,6 +19,8 @@ public class SpringAnimator {
private static double DAMPER = 35;
public static final String TAG = "SpringAnimation";
private static MainActivity app;
public static final int TO_LEFT = -1;
public static final int TO_RIGHT = 1;
public static void showExpandCameraGuide(final View view) {
view.setScaleX(0.1f);
@ -110,7 +111,7 @@ public class SpringAnimator {
return true;
case MotionEvent.ACTION_UP:
if (view == view.getRootView().findViewById(R.id.mainbuttonburger))
app.animateSettingsFragment();
FragmentAnimator.pressMenuButton(app);
spring.setEndValue(0f);
return true;
}
@ -124,9 +125,10 @@ public class SpringAnimator {
* Uses the Facebook Spring animation to show a bouncy animation on
* the view that is given as a parameter
*
* @param view a view to apply the bouncy animation
* @param view a view to apply the bouncy animation
* @param direction SpringAnimator.TO_LEFT or SpringAnimator.TO_RIGHT
*/
public static void showBouncySlide(final View view) {
public static void showBouncySlide(final View view, final int direction) {
SpringSystem springSystem = SpringSystem.create();
app = MainActivity.getApp();
@ -136,7 +138,6 @@ public class SpringAnimator {
spring.setSpringConfig(config);
spring.setEndValue(1f);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
spring.setEndValue(0f);
@ -152,8 +153,7 @@ public class SpringAnimator {
// state by asking its current value in onSpringUpdate.
float value = (float) spring.getCurrentValue();
view.setX(value * -10);
Log.d(TAG, "Update X: " + value);
view.setX(direction * (value * -20));
}
@Override
@ -168,7 +168,7 @@ public class SpringAnimator {
public void onSpringEndStateChange(Spring spring) {
}
});
}
}

113
app/src/main/java/com/breadwallet/tools/others/CurrencyManager.java

@ -1,7 +1,120 @@
package com.breadwallet.tools.others;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.Log;
import android.widget.ArrayAdapter;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.MainActivity;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by Mihail on 7/22/15.
*/
public class CurrencyManager {
private static MainActivity app = MainActivity.getApp();
public static final String TAG = "CurrencyManager";
private static ArrayAdapter currencyAdapter;
private static Timer timer;
private static TimerTask timerTask;
private static final Handler handler = new Handler();
public static boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager) app.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
public static List<String> getCurrencies() {
List<String> list = new ArrayList<>();
if (isNetworkAvailable()) {
JSONArray arr = null;
arr = JsonParser.getJSonArray("https://bitpay.com/rates");
for (int i = 1; i < arr.length(); i++) {
String tmp = null;
try {
JSONObject tmpObj = (JSONObject) arr.get(i);
tmp = tmpObj.getString("code") + " - " + tmpObj.getString("name");
} catch (JSONException e) {
e.printStackTrace();
}
list.add(tmp);
}
} else {
}
return list;
}
public static class GetCurrenciesTask extends AsyncTask {
List<String> tmp;
@Override
protected Object doInBackground(Object[] params) {
currencyAdapter = new ArrayAdapter(app, R.layout.currency_list_item);
tmp = getCurrencies();
return null;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
currencyAdapter.clear();
Log.e(TAG, "Cleared: adapter count: " + currencyAdapter.getCount());
currencyAdapter.addAll(tmp);
Log.e(TAG, "Filled: adapter count: " + currencyAdapter.getCount());
}
}
public static ArrayAdapter getCurrencyAddapterIfReady() {
new GetCurrenciesTask().execute();
return currencyAdapter;
}
public static void initializeTimerTask() {
timerTask = new TimerTask() {
public void run() {
//use a handler to run a toast that shows the current timestamp
handler.post(new Runnable() {
public void run() {
new GetCurrenciesTask().execute();
}
});
}
};
}
public static void startTimer() {
//set a new Timer
timer = new Timer();
//initialize the TimerTask's job
initializeTimerTask();
//schedule the timer, after the first 5000ms the TimerTask will run every 10000ms
timer.schedule(timerTask, 0, 30000); //
}
public static void stoptimertask() {
//stop the timer, if it's not already null
if (timer != null) {
timer.cancel();
timer = null;
}
}
}

58
app/src/main/java/com/breadwallet/tools/others/JsonParser.java

@ -1,7 +1,65 @@
package com.breadwallet.tools.others;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
/**
* Created by Mihail on 7/14/15.
*/
public class JsonParser {
public static final String TAG = "JsonParser";
public static JSONArray getJSonArray(String URL) {
String jsonString = callURL(URL);
System.out.println("\n\njsonString: " + jsonString);
JSONArray jsonArray = null;
try {
JSONObject obj = new JSONObject(jsonString);
jsonArray = obj.getJSONArray("data");
Log.e(TAG,"\n\njsonArray: " + jsonArray);
} catch (JSONException e) {
e.printStackTrace();
}
return jsonArray;
}
private static String callURL(String myURL) {
System.out.println("Requested URL:" + myURL);
StringBuilder sb = new StringBuilder();
URLConnection urlConn = null;
InputStreamReader in = null;
try {
URL url = new URL(myURL);
urlConn = url.openConnection();
if (urlConn != null)
urlConn.setReadTimeout(60 * 1000);
if (urlConn != null && urlConn.getInputStream() != null) {
in = new InputStreamReader(urlConn.getInputStream(),
Charset.defaultCharset());
BufferedReader bufferedReader = new BufferedReader(in);
if (bufferedReader != null) {
int cp;
while ((cp = bufferedReader.read()) != -1) {
sb.append((char) cp);
}
bufferedReader.close();
}
}
in.close();
} catch (Exception e) {
throw new RuntimeException("Exception while calling URL:" + myURL, e);
}
return sb.toString();
}
}

86
app/src/main/java/com/breadwallet/tools/others/MyClipboardManager.java

@ -1,7 +1,87 @@
package com.breadwallet.tools.others;
/**
* Created by Mihail on 7/14/15.
*/
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.ContentResolver;
import android.content.Context;
import android.net.Uri;
public class MyClipboardManager {
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static boolean copyToClipboard(Context context, String text) {
try {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
.getSystemService(context.CLIPBOARD_SERVICE);
clipboard.setText(text);
} else {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context
.getSystemService(context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData
.newPlainText("message", text);
clipboard.setPrimaryClip(clip);
}
return true;
} catch (Exception e) {
return false;
}
}
@SuppressLint("NewApi")
public static String readFromClipboard(Context context) {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
.getSystemService(context.CLIPBOARD_SERVICE);
return clipboard.getText().toString();
} else {
ClipboardManager clipboard = (ClipboardManager) context
.getSystemService(Context.CLIPBOARD_SERVICE);
// Gets a content resolver instance
ContentResolver cr = context.getContentResolver();
// Gets the clipboard data from the clipboard
ClipData clip = clipboard.getPrimaryClip();
if (clip != null) {
String text = null;
String title = null;
// Gets the first item from the clipboard data
ClipData.Item item = clip.getItemAt(0);
// Tries to get the item's contents as a URI pointing to a note
Uri uri = item.getUri();
// If the contents of the clipboard wasn't a reference to a
// note, then
// this converts whatever it is to text.
if (text == null) {
text = coerceToText(context, item).toString();
}
return text;
}
}
return "";
}
@SuppressLint("NewApi")
public static CharSequence coerceToText(Context context, ClipData.Item item) {
// If this Item has an explicit textual value, simply return that.
CharSequence text = item.getText();
if (text != null) {
return text;
} else {
return "no text";
}
}
}

6
app/src/main/java/com/breadwallet/tools/qrcode/QRCodeEncoder.java

@ -1,8 +1,10 @@
package com.breadwallet.tools.qrcode;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.telephony.PhoneNumberUtils;
import android.util.Log;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
@ -18,6 +20,7 @@ import java.util.Map;
public final class QRCodeEncoder {
private static final int WHITE = 0xFFFFFFFF;
private static final int BLACK = 0xFF000000;
public static final String TAG = "QRCodeEncoder";
private int dimension = Integer.MIN_VALUE;
private String contents = null;
@ -196,8 +199,9 @@ public final class QRCodeEncoder {
}
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
Log.e(TAG, "The Bitmap pixels: " + bitmap.getWidth() + " " + bitmap.getHeight());
return bitmap;
}

10
app/src/main/java/com/breadwallet/tools/qrcode/QRCodeReaderView.java

@ -68,18 +68,12 @@ public class QRCodeReaderView extends SurfaceView implements SurfaceHolder.Callb
public QRCodeReaderView(Context context) {
super(context);
long start = System.currentTimeMillis();
Log.e(TAG, "In the constructor before init, time: " + start);
init();
Log.e(TAG, "In the constructor after init, time spent: " + (System.currentTimeMillis() - start));
}
public QRCodeReaderView(Context context, AttributeSet attrs) {
super(context, attrs);
long start = System.currentTimeMillis();
Log.e(TAG, "In the constructor before init, time: " + start);
init();
Log.e(TAG, "In the constructor after init, time spent: " + (System.currentTimeMillis() - start));
}
public void setOnQRCodeReadListener(OnQRCodeReadListener onQRCodeReadListener) {
@ -92,10 +86,8 @@ public class QRCodeReaderView extends SurfaceView implements SurfaceHolder.Callb
@SuppressWarnings("deprecation")
private void init() {
long start = System.currentTimeMillis();
if (checkCameraHardware(getContext())) {
mCameraManager = new CameraManager(getContext());
mHolder = this.getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Need to set this flag despite it's deprecated
@ -105,10 +97,8 @@ public class QRCodeReaderView extends SurfaceView implements SurfaceHolder.Callb
mOnQRCodeReadListener.cameraNotFound();
}
}
Log.e(TAG, "Init method Time passed: " + (System.currentTimeMillis() - start));
}
/**
* *************************************************
* SurfaceHolder.Callback,Camera.PreviewCallback

3
app/src/main/res/drawable-hdpi/button.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/buttonblue" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/buttonbluepressed" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/buttonbluepressed" android:state_pressed="true" />
<item android:drawable="@drawable/buttonblue" />
</selector>

20
app/src/main/res/layouts/activities/layout/activity_main.xml

@ -4,7 +4,6 @@
android:id="@+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.breadwallet.presenter.activities.MainActivity">
<ImageView
@ -13,26 +12,24 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_marginTop="20dp"
android:background="@drawable/breadwalletupcentered" />
<Button
android:id="@+id/mainbuttonburger"
android:layout_width="25dp"
android:layout_height="20dp"
android:layout_alignBottom="@+id/mainbuttonlocker"
android:layout_alignParentLeft="true"
android:layout_width="28dp"
android:layout_height="25dp"
android:layout_alignBottom="@+id/maintextbreadwallet"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:background="@drawable/burger" />
<Button
android:id="@+id/mainbuttonlocker"
android:layout_width="20dp"
android:layout_height="25dp"
android:layout_width="23dp"
android:layout_height="30dp"
android:layout_alignBottom="@+id/maintextbreadwallet"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:background="@drawable/locker" />
@ -41,8 +38,7 @@
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/maintextbreadwallet"
android:background="@drawable/backgroundmain" />
android:layout_below="@+id/maintextbreadwallet" />
<ImageView
android:id="@+id/pagerindicator"

167
app/src/main/res/layouts/fragments/layout/fragment_about.xml

@ -4,109 +4,78 @@
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/settings_pressed"
android:id="@+id/about"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp">
<RelativeLayout
android:id="@+id/about"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="160dp"
android:background="@drawable/clickable_layout"
android:clickable="false">
<TextView
android:id="@+id/about1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:id="@+id/about_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="about"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/recovery_phrase"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/about"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:id="@+id/recovery_phrase_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="recovery phrase"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
android:text="breadwallet v 1.0 (testnet)"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/dark_grey" />
<TextView
android:id="@+id/about2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about1"
android:layout_centerHorizontal="true"
android:text="copyright \u00A9 2015 Mihail Gutan"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/dark_grey" />
<TextView
android:id="@+id/about3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about2"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="this app is open source"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/dark_grey" />
<TextView
android:id="@+id/about4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about3"
android:layout_centerHorizontal="true"
android:autoLink="web"
android:text="breadwallet.com"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/about5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about4"
android:textColor="@color/dark_grey"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="exchange rate data provided by"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/about6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about5"
android:layout_centerHorizontal="true"
android:textColor="@color/dark_grey"
android:layout_marginBottom="30dp"
android:text="bitpay.com/rates"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RelativeLayout
android:id="@+id/local_currency"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/recovery_phrase"
android:layout_marginTop="30dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="local currency"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/change_password"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/local_currency"
android:layout_marginTop="30dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="change passcode"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/darkblue" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/start_recovery_wallet"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/change_password"
android:background="@drawable/clickable_layout"
android:clickable="true">
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="start/recovery another wallet"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/red" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

29
app/src/main/res/layouts/fragments/layout/fragment_decoder.xml

@ -1,32 +1,15 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_decoder_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:id="@+id/fragment_decoder_layout">
<!--<com.breadwallet.tools.qrcode.QRCodeReaderView-->
<!--android:id="@+id/qrdecoderview"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--android:layout_alignParentLeft="true"-->
<!--android:layout_alignParentTop="true" />-->
<TextView
android:id="@+id/exampleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="----"
android:textAppearance="?android:attr/textAppearanceLarge" />
android:background="@color/black">
<ImageView
android:id="@+id/red_line_image"
android:id="@+id/camera_guide_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/exampleTextView"
android:src="@drawable/red_line" />
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:src="@drawable/cameraguide" />
</RelativeLayout>

123
app/src/main/res/layouts/fragments/layout/fragment_local_currency.xml

@ -4,109 +4,34 @@
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/settings_pressed"
android:id="@+id/local_currency"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp">
<RelativeLayout
android:id="@+id/about"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="40dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<ListView
android:id="@+id/currency_list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ListView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="No Internet Connection"
android:id="@+id/noInternetConnectionText"
android:textColor="@color/dark_grey"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="136dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Refresh"
android:id="@+id/currencyRefresh"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/about_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="about"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/recovery_phrase"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/about"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:id="@+id/recovery_phrase_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="recovery phrase"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/local_currency"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/recovery_phrase"
android:layout_marginTop="30dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="local currency"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/change_password"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/local_currency"
android:layout_marginTop="30dp"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="change passcode"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/darkblue" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/start_recovery_wallet"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/change_password"
android:background="@drawable/clickable_layout"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:text="start/recovery another wallet"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/red" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>

67
app/src/main/res/layouts/fragments/layout/fragment_main.xml

@ -1,32 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainfragment" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
android:id="@+id/mainfragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView android:id="@+id/maintextsendmoney" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@+id/maintextbreadwallet"
android:layout_centerHorizontal="true" android:layout_gravity="center"
android:layout_marginTop="120dp" android:text="send money:" android:textSize="24sp" />
<Button android:id="@+id/mainbuttonscanqrcode" android:layout_width="270dp"
android:layout_height="60dp" android:layout_below="@+id/maintextsendmoney" android:layout_centerHorizontal="true"
android:layout_gravity="center" android:layout_marginTop="32dp"
android:background="@drawable/button" android:text=" scan QR code "
android:textColor="@color/darkblue" android:textSize="20sp" />
<TextView
android:id="@+id/maintextsendmoney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/maintextbreadwallet"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="120dp"
android:text="send money:"
android:textSize="24sp" />
<Button android:id="@+id/mainbuttonpayaddressfromclipboard"
android:layout_width="270dp" android:layout_height="60dp"
android:layout_below="@+id/mainbuttonscanqrcode" android:layout_centerHorizontal="true"
android:layout_gravity="center" android:layout_marginTop="50dp"
android:background="@drawable/button" android:text=" pay address from clipboard " android:textColor="@color/darkblue"
<Button
android:id="@+id/mainbuttonscanqrcode"
android:layout_width="270dp"
android:layout_height="60dp"
android:layout_below="@+id/maintextsendmoney"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:background="@drawable/button"
android:text="scan QR code"
android:textColor="@color/darkblue"
android:textSize="20sp" />
<TextView android:id="@+id/textView" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@+id/mainbuttonpayaddressfromclipboard"
<Button
android:id="@+id/mainbuttonpayaddressfromclipboard"
android:layout_width="270dp"
android:layout_height="60dp"
android:layout_below="@+id/mainbuttonscanqrcode"
android:layout_centerHorizontal="true"
android:layout_gravity="center" android:layout_marginTop="15dp"
android:text="address" />
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:background="@drawable/buttonblue"
android:text="pay address from clipboard "
android:textColor="@color/darkblue"
android:textSize="20sp" />
<EditText
android:layout_marginTop="20dp"
android:textColor="@color/grey"
android:id="@+id/addresseditText"
android:layout_width="match_parent"
android:layout_height="150dp"
android:text="The address"
android:textAlignment="gravity"
android:layout_gravity="center_horizontal"
android:background="#00000000" />
</LinearLayout>

11
app/src/main/res/layouts/fragments/layout/fragment_settings.xml

@ -68,6 +68,17 @@
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/grey" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="20sp"
android:textColor="@color/darkblue"
android:id="@+id/three_letters_currency"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="40dp"/>
</RelativeLayout>
<RelativeLayout

1
app/src/main/res/layouts/fragments/layout/fragmentqr_main.xml

@ -26,6 +26,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mainaddresstext"
android:layout_below="@+id/mainimageqrcode"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"

17
app/src/main/res/layouts/layout/currency_list_item.xml

@ -1,5 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
</RelativeLayout>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/currency_item_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:textColor="@color/dark_grey"
android:text=""
android:gravity="center_vertical"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceLarge" />

2
app/src/main/res/values/colors.xml

@ -12,6 +12,8 @@
<item name="darkorange" type="color">#FFFF8800</item>
<item name="darkred" type="color">#FFCC0000</item>
<item name="grey" type="color">#ff787878</item>
<item name="light_grey" type="color">#ff9d9d9d</item>
<item name="dark_grey" type="color">#ff3b3b3b</item>
<item name="darkblue" type="color">#007fff</item>
<item name="walletorange" type="color">#ff8000</item>
<item name="white_trans" type="color">#64ffffff</item>

BIN
captures/Snapshot_2015.07.15_14.14.21.hprof

Binary file not shown.

BIN
captures/Snapshot_2015.07.15_14.14.39.hprof

Binary file not shown.

BIN
captures/Snapshot_2015.07.15_14.27.28.hprof

Binary file not shown.

BIN
captures/Snapshot_2015.07.15_14.27.43.hprof

Binary file not shown.

BIN
captures/Snapshot_2015.07.15_14.28.00.hprof

Binary file not shown.
Loading…
Cancel
Save