16
16
17
17
package no .digipost .android .gui .content ;
18
18
19
- import android .app .ActionBar ;
20
19
import android .app .Activity ;
21
20
import android .app .AlertDialog ;
22
21
import android .app .ProgressDialog ;
23
22
import android .content .ActivityNotFoundException ;
24
23
import android .content .Context ;
25
24
import android .content .DialogInterface ;
26
25
import android .content .Intent ;
27
- import android .net .Uri ;
28
26
import android .os .AsyncTask ;
29
27
import android .os .Build ;
30
28
import android .os .Bundle ;
31
29
import android .support .v7 .app .AppCompatActivity ;
32
- import android .support .v7 .widget .Toolbar ;
33
30
import android .text .Html ;
34
31
import android .text .Spanned ;
35
32
import android .util .Log ;
36
33
import android .view .Gravity ;
37
34
import android .view .LayoutInflater ;
38
35
import android .view .MenuItem ;
39
36
import android .view .View ;
40
- import android .widget .AdapterView ;
41
- import android .widget .Button ;
42
- import android .widget .LinearLayout ;
43
- import android .widget .ListView ;
37
+ import android .widget .*;
44
38
import com .google .android .gms .analytics .GoogleAnalytics ;
45
39
import no .digipost .android .DigipostApplication ;
46
40
import no .digipost .android .R ;
58
52
import no .digipost .android .gui .fragments .DocumentFragment ;
59
53
import no .digipost .android .gui .invoice .InvoiceBankAgreements ;
60
54
import no .digipost .android .gui .invoice .InvoiceOptionsActivity ;
55
+ import no .digipost .android .gui .metadata .AppointmentView ;
61
56
import no .digipost .android .model .*;
62
57
import no .digipost .android .utilities .*;
63
58
@@ -75,6 +70,7 @@ public abstract class DisplayContentActivity extends AppCompatActivity {
75
70
private FolderArrayAdapter folderAdapter ;
76
71
private String location ;
77
72
private String folderId ;
73
+ private GridLayout gridLayout ;
78
74
79
75
@ Override
80
76
protected void onCreate (Bundle savedInstanceState ) {
@@ -88,6 +84,7 @@ protected void onCreate(Bundle savedInstanceState) {
88
84
finish ();
89
85
}
90
86
}
87
+
91
88
}
92
89
93
90
@ Override
@@ -102,6 +99,39 @@ protected void onStop() {
102
99
GoogleAnalytics .getInstance (this ).reportActivityStop (this );
103
100
}
104
101
102
+ protected void setupMetadataView () {
103
+ if (content_type != ApplicationConstants .RECEIPTS ) {
104
+ showMetadata ();
105
+ }
106
+ }
107
+
108
+ private void showMetadata () {
109
+ Attachment attachment = DocumentContentStore .getDocumentAttachment ();
110
+ if (DocumentContentStore .getDocumentAttachment () != null ) {
111
+ ArrayList <Metadata > metadataList = attachment .getMetadata ();
112
+ for (Metadata metadata : metadataList ) {
113
+ if (metadata .type .equals (Metadata .APPOINTMENT )) {
114
+ addAppointmentView (metadata );
115
+ }
116
+ }
117
+ }
118
+ }
119
+
120
+ private void addAppointmentView (Metadata appointment ) {
121
+ appointment .title = "Du har fått en innkalling fra " + DocumentContentStore .getDocumentParent ().getCreatorName ();
122
+ LinearLayout containerLayout = (LinearLayout ) findViewById (R .id .container_layout );
123
+ AppointmentView appointmentView = AppointmentView .newInstance ();
124
+ appointmentView .setAppointment (appointment );
125
+ LinearLayout ll = new LinearLayout (this );
126
+ ll .setOrientation (LinearLayout .VERTICAL );
127
+ int randomId = (int ) (Math .random ()*100 );
128
+ ll .setId (randomId );
129
+ getFragmentManager ().beginTransaction ().add (ll .getId (), appointmentView , "appointmentView" + randomId ).commit ();
130
+
131
+ containerLayout .addView (ll ,0 );
132
+
133
+ }
134
+
105
135
protected void showContentProgressDialog (final AsyncTask task , String message ) {
106
136
progressDialog = DialogUtitities .getProgressDialogWithMessage (this , message );
107
137
progressDialog .setButton (DialogInterface .BUTTON_NEGATIVE , getString (R .string .abort ), new DialogInterface .OnClickListener () {
@@ -325,7 +355,7 @@ private void openInvoiceContent(Attachment attachment, Document document, Curren
325
355
}
326
356
327
357
private void showPaidInvoiceDialog (Invoice invoice ) {
328
- String timePaid = DataFormatUtilities .getFormattedDate (invoice .getPayment ().getTimePaid ());
358
+ String timePaid = FormatUtilities .getFormattedDate (invoice .getPayment ().getTimePaid ());
329
359
330
360
String title = getString (R .string .dialog_send_to_bank_paid_title );
331
361
String message = format (getString (R .string .dialog_send_to_bank_paid_message ), timePaid );
0 commit comments