Skip to content

Commit 5717b60

Browse files
Merge pull request #15 from flipkart-incubator/licensing
licensing header to demo app files
2 parents e1ac1c9 + ae2711e commit 5717b60

File tree

7 files changed

+120
-21
lines changed

7 files changed

+120
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ captures/
3434

3535
# Intellij
3636
*.iml
37+
.idea/
3738
.idea/workspace.xml
3839
.idea/tasks.xml
3940
.idea/gradle.xml

app/src/main/java/com/flipkart/youtubeviewdemo/MainActivity.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeviewdemo;
220

321
import android.content.Intent;
422
import android.os.Bundle;
523
import android.support.v7.app.AppCompatActivity;
624
import android.view.View;
725
import android.widget.Button;
8-
import android.widget.RelativeLayout;
926

1027
import com.flipkart.youtubeview.activity.YouTubeActivity;
1128
import com.flipkart.youtubeview.models.YouTubePlayerType;
@@ -19,10 +36,9 @@ protected void onCreate(Bundle savedInstanceState) {
1936
super.onCreate(savedInstanceState);
2037
setContentView(R.layout.activity_main);
2138

22-
Button singleYoutubePlayerButton = (Button) findViewById(R.id.singleYoutubePlayer);
23-
Button youtubeNativeFragmentButton = (Button) findViewById(R.id.youtubeNativeFragment);
24-
Button youtubeWebViewFragmentButton = (Button) findViewById(R.id.youtubeWebviewFragment);
25-
final RelativeLayout container = (RelativeLayout) findViewById(R.id.container);
39+
Button singleYoutubePlayerButton = findViewById(R.id.singleYoutubePlayer);
40+
Button youtubeNativeFragmentButton = findViewById(R.id.youtubeNativeFragment);
41+
Button youtubeWebViewFragmentButton = findViewById(R.id.youtubeWebviewFragment);
2642

2743
singleYoutubePlayerButton.setOnClickListener(new View.OnClickListener() {
2844
@Override

app/src/main/java/com/flipkart/youtubeviewdemo/helper/Constants.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeviewdemo.helper;
220

321
public class Constants {

app/src/main/java/com/flipkart/youtubeviewdemo/youtubenative/YouTubeNativeActivityDemo.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeviewdemo.youtubenative;
220

321
import android.os.Bundle;

app/src/main/java/com/flipkart/youtubeviewdemo/youtubenative/YouTubeNativeFragmentDemo.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeviewdemo.youtubenative;
220

321
import android.os.Bundle;
@@ -33,7 +51,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
3351
videoIds.add("ebXbLfLACGM");
3452
videoIds.add("mWRsgZuwf_8");
3553

36-
YouTubePlayerAdapter youTubePlayerAdapter = new YouTubePlayerAdapter(getContext(), videoIds, this, playerType);
54+
YouTubePlayerAdapter youTubePlayerAdapter = new YouTubePlayerAdapter(videoIds, this, playerType);
3755
view.setAdapter(youTubePlayerAdapter);
3856

3957
return view;

app/src/main/java/com/flipkart/youtubeviewdemo/youtubenative/YouTubePlayerAdapter.java

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeviewdemo.youtubenative;
220

3-
import android.content.Context;
421
import android.support.annotation.NonNull;
522
import android.support.v4.app.Fragment;
623
import android.support.v7.widget.RecyclerView;
@@ -20,7 +37,6 @@
2037
public class YouTubePlayerAdapter extends RecyclerView.Adapter<YouTubePlayerAdapter.YouTubePlayerViewHolder> {
2138

2239
private ArrayList<String> videoIds;
23-
private Context context;
2440
private Fragment fragment;
2541
private int playerType;
2642

@@ -31,8 +47,7 @@ public void loadImage(@NonNull ImageView imageView, @NonNull String url, int hei
3147
}
3248
};
3349

34-
public YouTubePlayerAdapter(Context context, ArrayList<String> contents, Fragment fragment, int playerType) {
35-
this.context = context;
50+
YouTubePlayerAdapter(ArrayList<String> contents, Fragment fragment, int playerType) {
3651
this.videoIds = contents;
3752
this.fragment = fragment;
3853
this.playerType = playerType;
@@ -43,8 +58,9 @@ public int getItemCount() {
4358
return videoIds.size();
4459
}
4560

61+
@NonNull
4662
@Override
47-
public YouTubePlayerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
63+
public YouTubePlayerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
4864
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.youtube_player, parent, false);
4965
return new YouTubePlayerViewHolder(view);
5066
}
@@ -55,17 +71,17 @@ public int getItemViewType(int position) {
5571
}
5672

5773
@Override
58-
public void onBindViewHolder(final YouTubePlayerViewHolder holder, int position) {
74+
public void onBindViewHolder(@NonNull final YouTubePlayerViewHolder holder, int position) {
5975
YouTubePlayerView playerView = holder.playerView;
6076
String videoId = videoIds.get(position);
6177

6278
playerView.initPlayer(Constants.API_KEY, videoId, "https://cdn.rawgit.com/flipkart-incubator/inline-youtube-view/60bae1a1/youtube-android/youtube_iframe_player.html", playerType, null, fragment, imageLoader);
6379
}
6480

65-
public static class YouTubePlayerViewHolder extends RecyclerView.ViewHolder {
66-
public YouTubePlayerView playerView;
81+
static class YouTubePlayerViewHolder extends RecyclerView.ViewHolder {
82+
YouTubePlayerView playerView;
6783

68-
public YouTubePlayerViewHolder(View view) {
84+
YouTubePlayerViewHolder(View view) {
6985
super(view);
7086
playerView = view.findViewById(R.id.youtube_player_view);
7187
}

inline-youtube-view/src/main/java/com/flipkart/youtubeview/util/$Precondition$Check.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
/*
2+
* Apache License
3+
* Version 2.0, January 2004
4+
* http://www.apache.org/licenses/LICENSE-2.0
5+
*
6+
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
*
8+
* Copyright (c) 2018 Flipkart Internet Pvt. Ltd.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11+
* this file except in compliance with the License. You may obtain a copy of the
12+
* License at http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software distributed
15+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*/
119
package com.flipkart.youtubeview.util;
220

321
public final class $Precondition$Check {
4-
public static void checkArgument(boolean expression) {
5-
if (!expression) {
6-
throw new IllegalArgumentException();
7-
}
8-
}
9-
1022
/**
1123
* Ensures that an expression checking an argument is true.
1224
*

0 commit comments

Comments
 (0)