Skip to content

Commit 5574606

Browse files
added share button
1 parent bac20be commit 5574606

File tree

15 files changed

+131
-94
lines changed

15 files changed

+131
-94
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
2929
implementation 'com.google.android.material:material:1.1.0-alpha10'
3030
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
31-
31+
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5'
3232
implementation "androidx.cardview:cardview:1.0.0"
3333

3434
implementation(name: 'gvr-keyboard', ext: 'aar')

app/release/output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
1+
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":2,"versionName":"1.1","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<?xml version="1.1" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.release.virtualinstructor">
5+
<uses-permission android:name="android.permission.INTERNET"/>
56

67
<application
78
android:allowBackup="true"
@@ -12,6 +13,7 @@
1213
android:supportsRtl="true"
1314
android:theme="@style/AppTheme"
1415
tools:replace="android:icon,android:theme">
16+
<activity android:name=".youtube"></activity>
1517
<activity android:name=".spalsh_activity">
1618
<intent-filter>
1719
<action android:name="android.intent.action.MAIN" />
@@ -27,8 +29,7 @@
2729
<activity android:name=".channel_yoga_list.yoga_channel2_list" />
2830
<activity
2931
android:name=".MainActivity"
30-
android:theme="@style/AppTheme">
31-
</activity>
32+
android:theme="@style/AppTheme"></activity>
3233
</application>
3334

3435
</manifest>

app/src/main/java/com/release/virtualinstructor/MainActivity.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
import androidx.appcompat.widget.SearchView;
66
import androidx.fragment.app.Fragment;
77

8+
import android.content.Intent;
89
import android.os.Bundle;
910
import android.view.MenuItem;
1011
import android.view.View;
1112
import android.widget.ArrayAdapter;
1213
import android.widget.ImageView;
14+
import android.widget.LinearLayout;
1315
import android.widget.ListView;
16+
import android.widget.RelativeLayout;
1417
import android.widget.Toast;
1518

1619
import com.google.android.material.bottomnavigation.BottomNavigationView;
@@ -31,6 +34,7 @@ protected void onCreate(Bundle savedInstanceState) {
3134

3235
final ImageView meditation = findViewById(R.id.meditation_tab);
3336
final ImageView yoga = findViewById(R.id.yoga_tab);
37+
LinearLayout share = findViewById(R.id.share);
3438

3539
//to start with yoga fragment
3640
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new meditation_fragment()).commit();
@@ -107,5 +111,23 @@ public boolean onQueryTextChange(String newText) {
107111
return false;
108112
}
109113
});*/
114+
115+
//share the app link using share button
116+
share.setOnClickListener(new View.OnClickListener() {
117+
@Override
118+
public void onClick(View v) {
119+
try {
120+
Intent shareIntent = new Intent(Intent.ACTION_SEND);
121+
shareIntent.setType("text/plain");
122+
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Virtual Instructor");
123+
String shareMessage= "\nDownload the app and meditate in virtual reality.\n\n";
124+
shareMessage = shareMessage + "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID +"\n";
125+
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
126+
startActivity(Intent.createChooser(shareIntent, "choose one"));
127+
} catch(Exception e) {
128+
//e.toString();
129+
}
130+
}
131+
});
110132
}
111133
}

app/src/main/java/com/release/virtualinstructor/meditation_fragment.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
2929
CardView focus_meditation = v.findViewById(R.id.focus_meditation); TextView focus = v.findViewById(R.id.focus);
3030
CardView mindfullness_meditation = v.findViewById(R.id.mindfulness_meditation); TextView minfullness = v.findViewById(R.id.mindfulness);
3131
CardView spiritual_meditation = v.findViewById(R.id.spiritual_meditation); TextView spiritual = v.findViewById(R.id.spiritual);
32-
32+
final CardView youtube = v.findViewById(R.id.youtube);
3333

3434
channel1.setOnClickListener(new View.OnClickListener() {
3535
@Override
@@ -51,6 +51,13 @@ public void onClick(View v) {
5151
}
5252
});*/
5353

54+
/*youtube.setOnClickListener(new View.OnClickListener() {
55+
@Override
56+
public void onClick(View v) {
57+
startActivity(new Intent(getActivity(), youtube.class));
58+
}
59+
});*/
60+
5461

5562
return v;
5663
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.release.virtualinstructor;
2+
3+
import androidx.appcompat.app.AppCompatActivity;
4+
5+
import android.content.pm.ActivityInfo;
6+
import android.os.Bundle;
7+
import android.view.WindowManager;
8+
9+
import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView;
10+
11+
public class youtube extends AppCompatActivity {
12+
13+
@Override
14+
protected void onCreate(Bundle savedInstanceState) {
15+
super.onCreate(savedInstanceState);
16+
setContentView(R.layout.activity_youtube);
17+
18+
YouTubePlayerView youTubePlayerView = findViewById(R.id.youtube_view);
19+
youTubePlayerView.enterFullScreen();
20+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
21+
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
22+
}
23+
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<vector android:height="32dp" android:viewportHeight="24.0"
2-
android:viewportWidth="24.0" android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
1+
<vector android:height="24dp" android:tint="#4F7282"
2+
android:viewportHeight="24.0" android:viewportWidth="24.0"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
34
<path android:fillColor="#FF000000" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
45
</vector>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="24dp" android:tint="#4F7282"
2+
android:viewportHeight="24.0" android:viewportWidth="24.0"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
5+
</vector>
-224 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
3+
4+
<corners android:radius="12sp"/>
5+
<solid android:color="#CDD5D8"/>
6+
7+
</shape>

0 commit comments

Comments
 (0)