-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPositionsActivity.java
More file actions
50 lines (42 loc) · 1.98 KB
/
PositionsActivity.java
File metadata and controls
50 lines (42 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package it.trade.android.exampleapp;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;
import java.util.List;
import it.trade.android.sdk.model.TradeItLinkedBrokerAccountParcelable;
import it.trade.android.sdk.model.TradeItPositionParcelable;
import it.trade.model.TradeItErrorResult;
import it.trade.model.callback.TradeItCallback;
import static it.trade.android.exampleapp.MainActivity.POSITIONS_PARAMETER;
public class PositionsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_positions);
final TextView textView = (TextView) this.findViewById(R.id.positions_textview);
textView.setMovementMethod(new ScrollingMovementMethod());
Intent intent = getIntent();
List<TradeItPositionParcelable> positions = intent.getParcelableArrayListExtra(POSITIONS_PARAMETER);
textView.setText(positions.toString());
TradeItLinkedBrokerAccountParcelable linkedBrokerAccount = intent.getParcelableExtra(MainActivity.PARCELED_ACCOUNT_PARAMETER);
TradeItPositionParcelable position = null;
for (TradeItPositionParcelable positionParcelable: positions) {
if (positionParcelable.isProxyVoteEligible) {
position = positionParcelable;
break;
}
}
linkedBrokerAccount.getProxyVoteUrl(position.symbol, new TradeItCallback<String>() {
@Override
public void onSuccess(String proxyVoteUrl) {
textView.setText("Proxyvote url for last position: " + proxyVoteUrl);
}
@Override
public void onError(TradeItErrorResult error) {
textView.setText("Error getting Proxyvote url for last position: " + error);
}
});
}
}