Repository navigation
Expand file tree
/
Copy pathunnamed.patch
More file actions
6998 lines (6998 loc) · 293 KB
/
Copy pathunnamed.patch
File metadata and controls
6998 lines (6998 loc) · 293 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Index: mobile/.gitignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/.gitignore (date 1472394581000)
+++ mobile/.gitignore (date 1472394581000)
@@ -0,0 +1,1 @@
+/build
Index: mobile/proguard-rules.pro
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/proguard-rules.pro (date 1472394581000)
+++ mobile/proguard-rules.pro (date 1472394581000)
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\migue_000\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
Index: mobile/src/androidTest/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ApplicationTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/androidTest/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ApplicationTest.java (date 1472394581000)
+++ mobile/src/androidTest/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ApplicationTest.java (date 1472394581000)
@@ -0,0 +1,13 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/URLWebViewClient.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/URLWebViewClient.java (date 1472394581000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/URLWebViewClient.java (date 1472394581000)
@@ -0,0 +1,23 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+/**
+ * Created by migue_000 on 28/08/2016.
+ */
+public class URLWebViewClient extends WebViewClient {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ if (Uri.parse(url).getHost().equals("www.example.com")) {
+ // This is my web site, so do not override; let my WebView load the page
+ return false;
+ }
+ // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+
+ return true;
+ }
+}
\ No newline at end of file
Index: mobile/src/main/res/drawable/ic_tab_menu.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/res/drawable/ic_tab_menu.xml (date 1472394581000)
+++ mobile/src/main/res/drawable/ic_tab_menu.xml (date 1472394581000)
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,5c1.66,0 3,1.34 3,3s-1.34,3 -3,3 -3,-1.34 -3,-3 1.34,-3 3,-3zM12,19.2c-2.5,0 -4.71,-1.28 -6,-3.22 0.03,-1.99 4,-3.08 6,-3.08 1.99,0 5.97,1.09 6,3.08 -1.29,1.94 -3.5,3.22 -6,3.22z"/>
+</vector>
Index: mobile/src/main/res/values-v21/styles.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/res/values-v21/styles.xml (date 1472394581000)
+++ mobile/src/main/res/values-v21/styles.xml (date 1472394581000)
@@ -0,0 +1,9 @@
+<resources>
+
+ <style name="AppTheme.NoActionBar">
+ <item name="windowActionBar">false</item>
+ <item name="windowNoTitle">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ </style>
+</resources>
Index: mobile/src/main/res/values-w820dp/dimens.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/res/values-w820dp/dimens.xml (date 1472394581000)
+++ mobile/src/main/res/values-w820dp/dimens.xml (date 1472394581000)
@@ -0,0 +1,6 @@
+<resources>
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
+ (such as screen margins) for screens with more than 820dp of available width. This
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
+ <dimen name="activity_horizontal_margin">64dp</dimen>
+</resources>
Index: mobile/src/test/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ExampleUnitTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/test/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ExampleUnitTest.java (date 1472394581000)
+++ mobile/src/test/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ExampleUnitTest.java (date 1472394581000)
@@ -0,0 +1,15 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
Index: wear/.gitignore
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/.gitignore (date 1472394581000)
+++ wear/.gitignore (date 1472394581000)
@@ -0,0 +1,1 @@
+/build
Index: wear/build.gradle
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/build.gradle (date 1472394581000)
+++ wear/build.gradle (date 1472394581000)
@@ -0,0 +1,27 @@
+apply plugin: 'com.android.application'
+
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "24.0.2"
+
+ defaultConfig {
+ applicationId "net.azurewebsites.pedromiguelmartins.pedromiguelmartins"
+ minSdkVersion 23
+ targetSdkVersion 24
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.google.android.support:wearable:2.0.0-alpha2'
+ compile 'com.google.android.gms:play-services-wearable:9.4.0'
+}
Index: wear/proguard-rules.pro
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/proguard-rules.pro (date 1472394581000)
+++ wear/proguard-rules.pro (date 1472394581000)
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\migue_000\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
Index: wear/src/main/AndroidManifest.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/src/main/AndroidManifest.xml (date 1472394581000)
+++ wear/src/main/AndroidManifest.xml (date 1472394581000)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="net.azurewebsites.pedromiguelmartins.pedromiguelmartins">
+
+ <uses-feature android:name="android.hardware.type.watch" />
+
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:supportsRtl="true"
+ android:theme="@android:style/Theme.DeviceDefault">
+ <uses-library
+ android:name="com.google.android.wearable"
+ android:required="false" />
+
+ <activity
+ android:name=".MainActivity"
+ android:label="@string/app_name"
+ android:theme="@android:style/Theme.DeviceDefault.Light">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
Index: wear/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/MainActivity.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/MainActivity.java (date 1472394581000)
+++ wear/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/MainActivity.java (date 1472394581000)
@@ -0,0 +1,64 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.os.Bundle;
+import android.support.wearable.activity.WearableActivity;
+import android.support.wearable.view.BoxInsetLayout;
+import android.view.View;
+import android.widget.TextView;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+public class MainActivity extends WearableActivity {
+
+ private static final SimpleDateFormat AMBIENT_DATE_FORMAT =
+ new SimpleDateFormat("HH:mm", Locale.US);
+
+ private BoxInsetLayout mContainerView;
+ private TextView mTextView;
+ private TextView mClockView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ setAmbientEnabled();
+
+ mContainerView = (BoxInsetLayout) findViewById(R.id.container);
+ mTextView = (TextView) findViewById(R.id.text);
+ mClockView = (TextView) findViewById(R.id.clock);
+ }
+
+ @Override
+ public void onEnterAmbient(Bundle ambientDetails) {
+ super.onEnterAmbient(ambientDetails);
+ updateDisplay();
+ }
+
+ @Override
+ public void onUpdateAmbient() {
+ super.onUpdateAmbient();
+ updateDisplay();
+ }
+
+ @Override
+ public void onExitAmbient() {
+ updateDisplay();
+ super.onExitAmbient();
+ }
+
+ private void updateDisplay() {
+ if (isAmbient()) {
+ mContainerView.setBackgroundColor(getResources().getColor(android.R.color.black));
+ mTextView.setTextColor(getResources().getColor(android.R.color.white));
+ mClockView.setVisibility(View.VISIBLE);
+
+ mClockView.setText(AMBIENT_DATE_FORMAT.format(new Date()));
+ } else {
+ mContainerView.setBackground(null);
+ mTextView.setTextColor(getResources().getColor(android.R.color.black));
+ mClockView.setVisibility(View.GONE);
+ }
+ }
+}
Index: wear/src/main/res/layout/activity_main.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/src/main/res/layout/activity_main.xml (date 1472394581000)
+++ wear/src/main/res/layout/activity_main.xml (date 1472394581000)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="net.azurewebsites.pedromiguelmartins.pedromiguelmartins.MainActivity"
+ tools:deviceIds="wear">
+
+ <TextView
+ android:id="@+id/text"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/hello_world"
+ app:layout_box="all" />
+
+ <TextView
+ android:id="@+id/clock"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|start"
+ android:textColor="@android:color/white"
+ app:layout_box="all" />
+
+</android.support.wearable.view.BoxInsetLayout>
Index: wear/src/main/res/values/strings.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wear/src/main/res/values/strings.xml (date 1472394581000)
+++ wear/src/main/res/values/strings.xml (date 1472394581000)
@@ -0,0 +1,4 @@
+<resources>
+ <string name="app_name">Pedro Miguel Martins</string>
+ <string name="hello_world">Hello World!</string>
+</resources>
Index: .idea/inspectionProfiles/profiles_settings.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- .idea/inspectionProfiles/profiles_settings.xml (date 1473111336000)
+++ .idea/inspectionProfiles/profiles_settings.xml (date 1473111336000)
@@ -0,0 +1,7 @@
+<component name="InspectionProjectProfileManager">
+ <settings>
+ <option name="PROJECT_PROFILE" value="Project Default" />
+ <option name="USE_PROJECT_PROFILE" value="true" />
+ <version value="1.0" />
+ </settings>
+</component>
\ No newline at end of file
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/AboutMeFragment.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/AboutMeFragment.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/AboutMeFragment.java (date 1473111336000)
@@ -0,0 +1,127 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.content.Context;
+import android.net.Uri;
+import android.os.Bundle;
+import android.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.google.android.gms.plus.PlusOneButton;
+
+/**
+ * A fragment with a Google +1 button.
+ * Activities that contain this fragment must implement the
+ * {@link AboutMeFragment.OnFragmentInteractionListener} interface
+ * to handle interaction events.
+ * Use the {@link AboutMeFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ */
+public class AboutMeFragment extends Fragment {
+ // TODO: Rename parameter arguments, choose names that match
+ // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+ private static final String ARG_PARAM1 = "param1";
+ private static final String ARG_PARAM2 = "param2";
+ // The request code must be 0 or greater.
+ private static final int PLUS_ONE_REQUEST_CODE = 0;
+ // The URL to +1. Must be a valid URL.
+ private final String PLUS_ONE_URL = "http://developer.android.com";
+ // TODO: Rename and change types of parameters
+ private String mParam1;
+ private String mParam2;
+ private PlusOneButton mPlusOneButton;
+
+ private OnFragmentInteractionListener mListener;
+
+ public AboutMeFragment() {
+ // Required empty public constructor
+ }
+
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment AboutMeFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ public static AboutMeFragment newInstance(String param1, String param2) {
+ AboutMeFragment fragment = new AboutMeFragment();
+ Bundle args = new Bundle();
+ args.putString(ARG_PARAM1, param1);
+ args.putString(ARG_PARAM2, param2);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mParam1 = getArguments().getString(ARG_PARAM1);
+ mParam2 = getArguments().getString(ARG_PARAM2);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View view = inflater.inflate(R.layout.fragment_about_me, container, false);
+
+ //Find the +1 button
+ mPlusOneButton = (PlusOneButton) view.findViewById(R.id.plus_one_button);
+
+ return view;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+
+ // Refresh the state of the +1 button each time the activity receives focus.
+ mPlusOneButton.initialize(PLUS_ONE_URL, PLUS_ONE_REQUEST_CODE);
+ }
+
+ // TODO: Rename method, update argument and hook method into UI event
+ public void onButtonPressed(Uri uri) {
+ if (mListener != null) {
+ mListener.onFragmentInteraction(uri);
+ }
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ if (context instanceof OnFragmentInteractionListener) {
+ mListener = (OnFragmentInteractionListener) context;
+ } else {
+ throw new RuntimeException(context.toString()
+ + " must implement OnFragmentInteractionListener");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mListener = null;
+ }
+
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ * <p/>
+ * See the Android Training lesson <a href=
+ * "http://developer.android.com/training/basics/fragments/communicating.html"
+ * >Communicating with Other Fragments</a> for more information.
+ */
+ public interface OnFragmentInteractionListener {
+ // TODO: Update argument type and name
+ void onFragmentInteraction(Uri uri);
+ }
+
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ActivityPdf.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ActivityPdf.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ActivityPdf.java (date 1473111336000)
@@ -0,0 +1,35 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.os.Bundle;
+import android.support.design.widget.FloatingActionButton;
+import android.support.design.widget.Snackbar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.webkit.WebView;
+
+public class ActivityPdf extends net.sf.andpdf.pdfviewer.PdfViewerActivity {
+ @Override
+ public int getPreviousPageImageResource() { return R.drawable.left_arrow; }
+ @Override
+ public int getNextPageImageResource() { return R.drawable.right_arrow; }
+ @Override
+ public int getZoomInImageResource() { return R.drawable.zoom_in; }
+ @Override
+ public int getZoomOutImageResource() { return R.drawable.zoom_out; }
+ @Override
+ public int getPdfPasswordLayoutResource() { return R.layout.pdf_file_password; }
+ @Override
+ public int getPdfPageNumberResource() { return R.layout.dialog_pagenumber; }
+ @Override
+ public int getPdfPasswordEditField() { return R.id.etPassword; }
+ @Override
+ public int getPdfPasswordOkButton() { return R.id.btOK; }
+ @Override
+ public int getPdfPasswordExitButton() { return R.id.btExit; }
+ @Override
+ public int getPdfPageNumberEditField() { return R.id.pagenum_edit; }
+
+
+
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListContacts.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListContacts.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListContacts.java (date 1473111336000)
@@ -0,0 +1,37 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class CustomListContacts extends ArrayAdapter<String> {
+
+
+ private final Activity context;
+ private final String[] web;
+ private final Integer[] imageId;
+ public CustomListContacts(Activity context,
+ String[] web, Integer[] imageId) {
+ super(context, R.layout.list_contacts_single, web);
+ this.context = context;
+ this.web = web;
+ this.imageId = imageId;
+
+ }
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ LayoutInflater inflater = context.getLayoutInflater();
+ View rowView= inflater.inflate(R.layout.list_contacts_single, null, true);
+ TextView txtTitle = (TextView) rowView.findViewById(R.id.txt);
+
+ ImageView imageView = (ImageView) rowView.findViewById(R.id.img);
+ txtTitle.setText(web[position]);
+
+ imageView.setImageResource(imageId[position]);
+ return rowView;
+ }
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListProjects.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListProjects.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListProjects.java (date 1473111336000)
@@ -0,0 +1,37 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.app.Activity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class CustomListProjects extends ArrayAdapter<String> {
+
+
+ private final Activity context;
+ private final String[] web;
+ private final Integer[] imageId;
+ public CustomListProjects(Activity context,
+ String[] web, Integer[] imageId) {
+ super(context, R.layout.list_projects_single, web);
+ this.context = context;
+ this.web = web;
+ this.imageId = imageId;
+
+ }
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ LayoutInflater inflater = context.getLayoutInflater();
+ View rowView= inflater.inflate(R.layout.list_projects_single, null, true);
+ TextView txtTitle = (TextView) rowView.findViewById(R.id.txt);
+
+ ImageView imageView = (ImageView) rowView.findViewById(R.id.img);
+ txtTitle.setText(web[position]);
+
+ imageView.setImageResource(imageId[position]);
+ return rowView;
+ }
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListTecnologies.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListTecnologies.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/CustomListTecnologies.java (date 1473111336000)
@@ -0,0 +1,55 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.design.widget.FloatingActionButton;
+import android.support.design.widget.Snackbar;
+import android.support.design.widget.TabLayout;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.webkit.WebView;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class CustomListTecnologies extends ArrayAdapter<String> {
+
+
+ private final Activity context;
+ private final String[] web;
+ private final Integer[] imageId;
+ public CustomListTecnologies(Activity context,
+ String[] web, Integer[] imageId) {
+ super(context, R.layout.list_tecnology_single, web);
+ this.context = context;
+ this.web = web;
+ this.imageId = imageId;
+
+ }
+ @Override
+ public View getView(int position, View view, ViewGroup parent) {
+ LayoutInflater inflater = context.getLayoutInflater();
+ View rowView= inflater.inflate(R.layout.list_tecnology_single, null, true);
+ TextView txtTitle = (TextView) rowView.findViewById(R.id.txt);
+
+ ImageView imageView = (ImageView) rowView.findViewById(R.id.img);
+ txtTitle.setText(web[position]);
+
+ imageView.setImageResource(imageId[position]);
+ return rowView;
+ }
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/HomeFragment.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/HomeFragment.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/HomeFragment.java (date 1473111336000)
@@ -0,0 +1,173 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.AssetManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+
+import net.sf.andpdf.pdfviewer.PdfViewerActivity;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+
+/**
+ * A simple {@link Fragment} subclass.
+ * Activities that contain this fragment must implement the
+ * {@link HomeFragment.OnFragmentInteractionListener} interface
+ * to handle interaction events.
+ * Use the {@link HomeFragment#newInstance} factory method to
+ * create an instance of this fragment.
+ *
+ */
+public class HomeFragment extends Fragment {
+ // TODO: Rename parameter arguments, choose names that match
+ // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+ private static final String ARG_PARAM1 = "param1";
+ private static final String ARG_PARAM2 = "param2";
+
+ // TODO: Rename and change types of parameters
+ private String mParam1;
+ private String mParam2;
+
+ private OnFragmentInteractionListener mListener;
+
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment HomeFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ public static HomeFragment newInstance(String param1, String param2) {
+ HomeFragment fragment = new HomeFragment();
+ Bundle args = new Bundle();
+ args.putString(ARG_PARAM1, param1);
+ args.putString(ARG_PARAM2, param2);
+ fragment.setArguments(args);
+ return fragment;
+ }
+ public HomeFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mParam1 = getArguments().getString(ARG_PARAM1);
+ mParam2 = getArguments().getString(ARG_PARAM2);
+ }
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View inflate = inflater.inflate(R.layout.fragment_home, container, false);
+ Button buttonCV = (Button) inflate.findViewById(R.id.getCV);
+ buttonCV.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+
+
+ copyAssets();
+
+
+
+ }
+ });
+ return inflate;
+ }
+ private void copyAssets() {
+ AssetManager assetManager = this.getActivity().getAssets();
+
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = assetManager.open("Files/cv.pdf");
+ File outFile = new File(this.getActivity().getExternalFilesDir(null), "cv_temp.pdf");
+ out = new FileOutputStream(outFile);
+ copyFile(in, out);
+ Intent intent = new Intent(this.getActivity(), ActivityPdf.class);
+ intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, outFile.getAbsolutePath());
+ startActivity(intent);
+ } catch(IOException e) {
+ Log.e("tag", "Failed to copy asset file: cv.pdf ", e);
+ }
+ finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // NOOP
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // NOOP
+ }
+ }
+ }
+
+ }
+ private void copyFile(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[1024];
+ int read;
+ while((read = in.read(buffer)) != -1){
+ out.write(buffer, 0, read);
+ }
+ }
+
+ // TODO: Rename method, update argument and hook method into UI event
+ public void onButtonPressed(Uri uri) {
+ if (mListener != null) {
+ mListener.onFragmentInteraction(uri);
+ }
+ }
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ if (context instanceof OnFragmentInteractionListener) {
+ mListener = (OnFragmentInteractionListener) context;
+ } else {
+ throw new RuntimeException(context.toString()
+ + " must implement OnFragmentInteractionListener");
+ }
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ mListener = null;
+ }
+
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ * <p>
+ * See the Android Training lesson <a href=
+ * "http://developer.android.com/training/basics/fragments/communicating.html"
+ * >Communicating with Other Fragments</a> for more information.
+ */
+ public interface OnFragmentInteractionListener {
+ // TODO: Update argument type and name
+ void onFragmentInteraction(Uri uri);
+ }
+}
Index: mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ProjectsActivity.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ProjectsActivity.java (date 1473111336000)
+++ mobile/src/main/java/net/azurewebsites/pedromiguelmartins/pedromiguelmartins/ProjectsActivity.java (date 1473111336000)
@@ -0,0 +1,315 @@
+package net.azurewebsites.pedromiguelmartins.pedromiguelmartins;
+
+import android.support.annotation.NonNull;
+import android.support.design.widget.TabLayout;
+import android.support.design.widget.FloatingActionButton;
+import android.support.design.widget.Snackbar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+
+import android.webkit.WebView;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class ProjectsActivity extends AppCompatActivity {
+
+ /**
+ * The {@link android.support.v4.view.PagerAdapter} that will provide
+ * fragments for each of the sections. We use a
+ * {@link FragmentPagerAdapter} derivative, which will keep every
+ * loaded fragment in memory. If this becomes too memory intensive, it
+ * may be best to switch to a
+ * {@link android.support.v4.app.FragmentStatePagerAdapter}.
+ */
+ private SectionsPagerAdapter mSectionsPagerAdapter;
+
+ /**
+ * The {@link ViewPager} that will host the section contents.
+ */
+ private ViewPager mViewPager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_projects);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ // Create the adapter that will return a fragment for each of the three
+ // primary sections of the activity.
+ mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
+
+ // Set up the ViewPager with the sections adapter.
+ mViewPager = (ViewPager) findViewById(R.id.container);
+ mViewPager.setAdapter(mSectionsPagerAdapter);
+
+ TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
+ tabLayout.setupWithViewPager(mViewPager);
+
+ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
+ fab.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
+ .setAction("Action", null).show();
+ }
+ });
+
+ }
+
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {