Skip to content

Commit

Permalink
Add share feature (#24)
Browse files Browse the repository at this point in the history
Add share feature (but not popup dialog)
  • Loading branch information
ojasa authored and Kevin Black committed Nov 14, 2016
1 parent a809713 commit 21509b5
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ dependencies {
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.github.amlcurran.showcaseview:library:5.0.0'
compile 'com.google.android.gms:play-services-analytics:9.0.2'

compile 'com.github.hotchemi:android-rate:1.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -25,6 +26,11 @@
import com.manateams.android.manateams.views.DrawerAdapter;
import com.manateams.scraper.data.Course;

import hotchemi.android.rate.AppRate;
import hotchemi.android.rate.OnClickButtonListener;

import static android.content.DialogInterface.BUTTON_POSITIVE;


public class CoursesActivity extends AppCompatActivity {

Expand Down Expand Up @@ -157,6 +163,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
startActivity(intent);
finish();
break;
case R.id.action_share:
sendShareIntent();
break;
}
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
Expand All @@ -171,6 +180,13 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
}
}

public void sendShareIntent() {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "Check your grades with manaTEAMS http://manateams.com");
sendIntent.setType("text/plain");
startActivity(sendIntent);
}

public void onNeilWebsiteClick(View v) {
String url = "http://patil215.github.io";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
Expand All @@ -26,6 +27,9 @@
import com.manateams.scraper.data.ClassGrades;
import com.manateams.scraper.data.Course;

import hotchemi.android.rate.AppRate;
import hotchemi.android.rate.OnClickButtonListener;


public class MainActivity extends AppCompatActivity implements AsyncTaskCompleteListener {

Expand Down Expand Up @@ -76,6 +80,7 @@ protected void onCreate(Bundle savedInstanceState) {
login();
}
}

}

@Override
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/menu/courses.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.manateams.android.manateams.CoursesActivity" >

<item
android:id="@+id/action_share"
android:showAsAction="always"
android:title="@string/action_share"
/>

<item
android:id="@+id/action_refresh"
android:showAsAction="always"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="text_lastupdated_default">Grades not updated - pull down to refresh</string>
<string name="text_course_lastupdated_default">Grades not updated yet</string>
<string name="action_logout">Logout</string>
<string name="action_share">Share</string>
<string name="secondary_login_info">If you use separate credentials for your TEAMS account, enter them below</string>
<string name="secondary_login_title">Secondary Login</string>
<string name="text_gpa_default">GPA: 4.205 / 3.057</string>
Expand All @@ -81,5 +82,11 @@
<string name="text_login_instructions">Log in with the credentials you use to sign into my.austinisd.org.</string>
<string name="action_refresh">Refresh</string>

<string name="rate_dialog_title">Share this app</string>
<string name="rate_dialog_message">If you enjoy playing this app, would you mind taking a moment to share it with your friends? It won\'t take more than a minute. Thanks for your support!</string>
<string name="rate_dialog_ok">Share It Now</string>
<string name="rate_dialog_cancel">Remind Me Later</string>
<string name="rate_dialog_no">No, Thanks</string>


</resources>

0 comments on commit 21509b5

Please sign in to comment.