예제 #1
0
 @Override
 public void onClick(View v) {
   if (v == iconFavorite) {
     if (isFavorite) {
       isFavorite = false;
       iconFavorite.setTextColor(getResources().getColor(R.color.gray));
       favoriteController.delete(LocalStorage.getInstance().getMember(), jobdetail);
     } else {
       isFavorite = true;
       iconFavorite.setTextColor(getResources().getColor(R.color.pink_500));
       favoriteController.store(LocalStorage.getInstance().getMember(), jobdetail);
       progressDialog.show();
     }
   } else if (v == iconResume) {
     Intent intent = new Intent(getActivity(), SendResumeActivity.class);
     intent.putExtra(getString(R.string.intent_obj), jobdetail.getId());
     startActivity(intent);
   } else {
     // Operator has not lat&lng
     if (jobdetail.getOperator().getLat().isEmpty()
         || jobdetail.getOperator().getLng().isEmpty()) {
       Toast.makeText(getActivity(), getString(R.string.error_gps_null), Toast.LENGTH_SHORT)
           .show();
     } else {
       double lat = Double.parseDouble(jobdetail.getOperator().getLat());
       double lng = Double.parseDouble(jobdetail.getOperator().getLng());
       LatLng latLng = new LatLng(lat, lng);
       navigation(latLng);
     }
   }
 }
예제 #2
0
 @Subscribe
 public void deleteFavoriteSubscribe(FavoriteEvent.Delete deleteFavoriteEvent) {
   if (deleteFavoriteEvent.isSuccess()) {
     isFavorite = false;
     iconFavorite.setTextColor(getResources().getColor(R.color.gray));
   } else {
     isFavorite = true;
     iconFavorite.setTextColor(getResources().getColor(R.color.pink_500));
   }
 }
  private void animateTooltip(long fadeDuration, long startFadeTime, LinearInterpolator linInter) {
    AlphaAnimation mAlAnimation = new AlphaAnimation(0, 1);
    mAlAnimation.setDuration(fadeDuration);
    mAlAnimation.setStartOffset(startFadeTime);
    mAlAnimation.setInterpolator(linInter);

    watchProgressArrow.startAnimation(mAlAnimation);
    watchProgressText.startAnimation(mAlAnimation);
    watchProgressArrow.setVisibility(View.VISIBLE);
    watchProgressText.setVisibility(View.VISIBLE);
  }
예제 #4
0
  @Subscribe
  public void checkFavoriteSubscribe(FavoriteEvent.Check checkFavoriteEvent) {
    if (checkFavoriteEvent.isSuccess()) {
      isFavorite = checkFavoriteEvent.isChecked();
      iconFavorite.setTextColor(getResources().getColor(R.color.pink_500));
    } else {
      isFavorite = checkFavoriteEvent.isChecked();
      iconFavorite.setTextColor(getResources().getColor(R.color.gray));
    }

    progressDialog.dismiss();
  }
예제 #5
0
    private void initializeAmount(TransactionUIModel transaction) {
      IconTextView transactionIcon =
          (IconTextView) itemView.findViewById(R.id.transactionTypeImage);

      transactionIcon.setText(
          transaction.isIncome()
              ? context.getText(R.string.basketFill)
              : context.getText(R.string.basketUnFill));

      TextView amountView = (TextView) itemView.findViewById(R.id.transactionAmount);
      amountView.setText(
          CurrencyUtil.formatCurrency(transaction.getAmount(), transaction.getCurrencyType()));
    }
예제 #6
0
    private void initializeImageButton(final TransactionUIModel transaction) {
      IconTextView goalImage = (IconTextView) itemView.findViewById(R.id.goalTransactionButton);

      if (transaction.getGoalTransaction() != null || transaction.isIncome()) {
        goalImage.setVisibility(View.GONE);
      } else {
        goalImage.setVisibility(View.VISIBLE);
      }

      goalImage.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              showGoalTransactionDialog(transaction);
            }
          });
    }
예제 #7
0
  private void initInstances(View root) {
    collapsingToolbarLayout =
        (CollapsingToolbarLayout) getActivity().findViewById(R.id.collapsing_toolbar);
    toolbar = (Toolbar) getActivity().findViewById(R.id.toolbar);
    ivLogo = (ImageView) getActivity().findViewById(R.id.ivLogo);

    linearLayoutTabOptions = (LinearLayout) root.findViewById(R.id.linearLayoutTabOptions);
    iconFavorite = (IconTextView) root.findViewById(R.id.iconFavorite);
    iconResume = (IconTextView) root.findViewById(R.id.iconResume);
    iconNavigator = (IconTextView) root.findViewById(R.id.iconNavigator);
    layoutNavigator = (LinearLayout) root.findViewById(R.id.layoutNavigator);
    tvAddress = (TextView) root.findViewById(R.id.tvAddress);
    tvSalary = (TextView) root.findViewById(R.id.tvSalary);
    tvWelfare = (TextView) root.findViewById(R.id.tvWelfare);
    tvRequirement = (TextView) root.findViewById(R.id.tvRequirement);
    tvDescription = (TextView) root.findViewById(R.id.tvDescription);
    tvJob = (TextView) root.findViewById(R.id.tvJob);
    tvNotice = (TextView) root.findViewById(R.id.tvNotice);

    //        collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.black));

    iconFavorite.setOnClickListener(onClickListener);
    iconResume.setOnClickListener(onClickListener);
    iconNavigator.setOnClickListener(onClickListener);

    isFavorite = true;

    busProvider = BusProvider.getInstance(getActivity());
    jobdetailController =
        new JobdetailController(
            getActivity(), busProvider, HTTPManager.getInstance(), GsonManager.getInstance());
    favoriteController =
        new FavoriteController(
            getActivity(), busProvider, HTTPManager.getInstance(), GsonManager.getInstance());

    authorizeMember();

    progressDialog = new ProgressDialog(getActivity());
    progressDialog.setMessage(getString(R.string.loading));
    progressDialog.setCancelable(false);
    progressDialog.show();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    final View view = inflater.inflate(R.layout.fragment_wallet, container, false);
    Log.i(TAG, "onCreateView");

    syncingLayout = (LinearLayout) view.findViewById(R.id.syncingLayout);
    syncedLayout = (LinearLayout) view.findViewById(R.id.syncedLayout);
    linearLayout = (LinearLayout) view.findViewById(R.id.linearLayout);
    syncingText = (TextView) view.findViewById(R.id.syncingText);
    aliasNameText = (TextView) view.findViewById(R.id.aliasName);
    aliasNameUnconfirmed = (TextView) view.findViewById(R.id.aliasNameUnconfirmed);
    currentAddressText = (TextView) view.findViewById(R.id.currentAddress);
    currentQrCode = (ImageView) view.findViewById(R.id.currentQrCode);
    identicon = (ImageView) view.findViewById(R.id.identicon);
    btcBalance = (CurrencyView) view.findViewById(R.id.btcBalance);
    setAliasButton = (Button) view.findViewById(R.id.setAlias);
    btcBalanceUnconfirmed = (TextView) view.findViewById(R.id.btcBalanceUnconfirmed);
    messagePending = (TextView) view.findViewById(R.id.messagePending);
    btcQR = (IconTextView) view.findViewById(R.id.btcQR);
    txtHeader = (TextView) view.findViewById(R.id.txtHeader);
    // myMessageList       = (ListView) view.findViewById(R.id.myMessageList);
    recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
    walletWarning = (TextView) view.findViewById(R.id.wallet_warning);

    btcQR.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            QRDialogFragment qrDialogFragment = new QRDialogFragment();
            qrDialogFragment.show(
                getFragmentManager(), PersonalNodeDialogFragment.class.toString());
          }
        });

    setAliasButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Long walletBalance = walletObservable.getWalletBalance().longValue();
            Log.i(TAG, "walletBalance=" + walletBalance);
            if (walletBalance < (EWWalletService.DUST + EWWalletService.FEE)) {
              Toast.makeText(
                      getActivity(),
                      "You need at least 0.2 mBTC confirmed balance to register an alias",
                      Toast.LENGTH_LONG)
                  .show();
              return;
            }

            FragmentTransaction ft = getFragmentManager().beginTransaction();
            Fragment prev = getFragmentManager().findFragmentByTag("dialog");
            if (prev != null) ft.remove(prev);
            ft.addToBackStack(null);

            RegAliasDialogFragment frag = new RegAliasDialogFragment();
            frag.setWalletObservable(walletObservable);
            frag.show(ft, "dialog");
          }
        });

    currentQrCode.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (walletObservable != null
                && walletObservable.getCurrent() != null
                && Bitcoin.isValidAddress(walletObservable.getCurrent().toString())) {
              Intent i =
                  new Intent(
                      Intent.ACTION_VIEW,
                      Uri.parse("bitcoin:" + walletObservable.getCurrent().toString()));
              if (isAvailable(i)) startActivity(i);
              else {
                AlertDialog d =
                    new AlertDialog.Builder(getActivity())
                        .setTitle(getString(R.string.app_name))
                        .setMessage(
                            "There are no bitcoin wallet app installed, do you want to install GreenBits?")
                        .setNegativeButton(
                            "No, thanks",
                            new DialogInterface.OnClickListener() {
                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                              }
                            })
                        .setPositiveButton(
                            "Yes" + "!",
                            new DialogInterface.OnClickListener() {
                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                                startActivity(
                                    new Intent(
                                        Intent.ACTION_VIEW,
                                        Uri.parse(
                                            "market://details?id="
                                                + "com.greenaddress.greenbits_android_wallet")));
                              }
                            })
                        .create();
                d.show();
              }
            }
          }
        });

    // Show / Hide write button
    payButton =
        (android.support.design.widget.FloatingActionButton) view.findViewById(R.id.payButton);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
    String passphrase = sharedPref.getString(Preferences.PASSPHRASE, null);
    if (passphrase == null) {
      // Hide write button on activity if there is no account
      payButton.setVisibility(View.GONE);
    } else {
      // Show write button on activity if there is one account
      payButton.setVisibility(View.VISIBLE);
      payButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent i = new Intent(getActivity(), WriteActivity.class);
              startActivity(i);
            }
          });
    }

    // Set Recyclerview
    final LinearLayoutManager mLayoutManager =
        new LinearLayoutManager(getActivity().getApplicationContext());
    mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(mLayoutManager);

    // Load my messages
    messages = new ArrayList<Message>();
    inQueue = null;

    // Set Message RecyclerView Adapter
    LruCache<String, Bitmap> bitmapCache = null;
    final FragmentActivity activity = getActivity();
    if (activity != null) {
      bitmapCache = ((EWApplication) activity.getApplication()).getBitmapCache();
    }
    messageRecyclerViewAdapter =
        new MessageRecyclerViewAdapter(messages, inQueue, WalletFragment.this, bitmapCache);
    recyclerView.setAdapter(messageRecyclerViewAdapter);

    // check on wallet observable
    if (walletObservable == null) {
      // do nothig.. wait
    } else if (walletObservable.isSyncedOrPending()) {
      syncedLayout.setVisibility(View.VISIBLE);
      syncingLayout.setVisibility(View.GONE);
      loadMoreData();
    } else {
      syncedLayout.setVisibility(View.GONE);
      syncingLayout.setVisibility(View.VISIBLE);
    }

    return view;
  }