Git Product home page Git Product logo

udacityalumni's People

Contributors

bengoblue05 avatar carlosrzisc avatar chashmeetsingh avatar dvik avatar dzarrillo avatar kartikarora avatar knightcube avatar ogasimli avatar ppartisan avatar tal32123 avatar tefic avatar therajanmaurya avatar vikasdesale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

udacityalumni's Issues

ToDo: Add Share functionality to the detail/article pages

See ToDo in ArticleDetailActivity

Steps to reproduce

Open the app, select an article from the home screen and press the "Share" button on the toolbar.

Expected behaviour

I expect the share menu to appear so I can share a link to the article on the current page.

Actual behaviour

Nothing happens; a long press shows a Toast message.

Tapping on bookmark open the details activity

Steps to reproduce

Tap on the list item to go to detail view
Come back to list view.
Tap on bookmark.

Expected behavior

The list item should be bookmarked

Actual behavior

The list item gets bookmarked and the detail view is also shown

Code Sample

Problem probably in onLoadFinished() of MainActivity (https://github.com/BenGoBlue05/UdacityAlumni/blob/master/app/src/main/java/com/google/developer/udacityalumni/activity/MainActivity.java)

This should not be there in onLoadFinished():


startActivity(new Intent(this, ArticleDetailActivity.class)
                    .putExtra(getString(R.string.article_list_key), ids)
                    .putExtra(getString(R.string.article_bookmarks_key), isBookmarked)
                    .putExtra(getString(R.string.tag_key), tags));

SignIn Button not working

Steps to reproduce

1)In the LoginActivity.java when i make the following changes-
a) Remove this line - findViewById(R.id.sign_in_button).setOnClickListener(this);
b)And use @OnClick annotation on sign_in_button because we are using butterknife library why doesn't the button respond to the click?

Expected behavior

Button click should be noticed

Actual behavior

Button does not respond. There is no crash as such. It is just a doubt

Code Sample

I changed the LoginActivity.java file to this -

package com.google.developer.udacityalumni.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.developer.udacityalumni.R;
import com.google.developer.udacityalumni.model.User;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.GoogleAuthProvider;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import butterknife.OnClick;

/**
 * A login screen that offers login via email/password.
 */
public class LoginActivity extends BaseActivity implements GoogleApiClient.OnConnectionFailedListener {

    private static final String LOG_TAG = LoginActivity.class.getSimpleName();

    private static final int RC_SIGN_IN = 9001;
    private GoogleApiClient mGoogleApiClient;
    private FirebaseAuth mAuth;
    private DatabaseReference mDatabase;
    private FirebaseAuth.AuthStateListener mAuthListener;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        getWindow().setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark));
        mAuth = FirebaseAuth.getInstance();
        mDatabase = FirebaseDatabase.getInstance().getReference();
        GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestIdToken(getString(R.string.default_web_client_id))
                .requestEmail()
                .build();

        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .enableAutoManage(this, this /* OnConnectionFailedListener */)
                .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
                .build();

        mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) bindUserValues(user);
            }
        };
    }

    private void bindUserValues(@NonNull FirebaseUser user) {
        DatabaseReference ref = mDatabase.child("users").child(user.getUid());
        String displayName = user.getDisplayName();
        String email = user.getEmail();
        String photoUrl = user.getPhotoUrl() != null ? user.getPhotoUrl().toString() : null;
        User usr = new User(displayName, email, photoUrl);
        ref.setValue(usr);
    }

    @OnClick(R.id.sign_in_button)
    public void signInButtonClicked(){
        Log.i("TAG", "signInButtonClicked: ");
        signIn();
    }

    private void signIn() {
        Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
        startActivityForResult(signInIntent, RC_SIGN_IN);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            if (result.isSuccess()) {
                GoogleSignInAccount account = result.getSignInAccount();
                firebaseAuthWithGoogle(account);
            } else {
                Log.e(LOG_TAG, "Google Sign In failed.");
            }
        }
    }


    private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
        Log.d(LOG_TAG, "firebaseAuthWithGoogle:" + acct.getId());
        showProgressDialog();
        AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null);
        mAuth.signInWithCredential(credential)
                .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                    @Override
                    public void onComplete(@NonNull Task<AuthResult> task) {
                        Log.i(LOG_TAG, "signIn:onComplete:" + task.isSuccessful());
                        hideProgressDialog();
                        if (!task.isSuccessful()) {
                            Log.i(LOG_TAG, "signInWithCredential", task.getException());
                            Toast.makeText(LoginActivity.this, "Authentication failed.",
                                    Toast.LENGTH_SHORT).show();
                        }
                        startActivity(new Intent(LoginActivity.this, MainActivity.class));
                    }
                });
    }


    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
        // An unresolvable error has occurred and Google APIs (including Sign-In) will not
        // be available.
        Log.d(LOG_TAG, "onConnectionFailed:" + connectionResult);
        Toast.makeText(this, "Google Play Services error.", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onStart() {
        super.onStart();
        mAuth.addAuthStateListener(mAuthListener);
    }

    @Override
    public void onStop() {
        super.onStop();
        if (mAuthListener != null) {
            mAuth.removeAuthStateListener(mAuthListener);
        }
    }
}

Empty tag list in json causes App crash

Steps to reproduce

when article have empty tags list, It causes App Crash

365/com.google.developer.udacityalumni E/AndroidRuntime: FATAL EXCEPTION: IntentService[AlumIntentService]
                                                                                  Process: com.google.developer.udacityalumni, PID: 1239
                                                                                  java.lang.IllegalArgumentException: n <= 0: 0
                                                                                      at java.util.Random.nextInt(Random.java:182)
                                                                                      at com.google.developer.udacityalumni.service.AlumIntentService.addArticles(AlumIntentService.java:54)
                                                                                      at com.google.developer.udacityalumni.service.AlumIntentService.onHandleIntent(AlumIntentService.java:108)
                                                                                      at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.os.HandlerThread.run(HandlerThread.java:61)

check last article item in json response

Expected behavior

AlumIntentService should check for empty tag list in json response before using it.

Remove JSONObject Matching in AlumIntentService with Gson

Steps to reproduce

Right now in AlumIntentService we are casting the JSONObject and JSONArray.

Expected behavior

Json String Casting can be done many ways, but Gson is the best one for now.

Actual behavior

it will be easy for any buddy to just call a method of from Utils to serialize the Json String to Java Object.

Basic DI setup

It would be nice if the project has a DI setup in place. Not only it will help in development and following best practices but can also be a starting point for developers and students new to the term.

add_animation_on_recycler_view

Steps to reproduce

What are steps we can follow to reproduce this issue?

Expected behavior

What did you expected to happen?

Actual behavior

What did happened instead?
e.g. the stack trace of a crash

Code Sample

Provide a code sample or test case that highlights the issue.
If relevant, include your model definitions.
For larger code samples, links to external gists / repositories are preferred.

App crashes on first load with IllegalArgumentException

Steps to reproduce

Open the application. Shortly after loading the home page, the application will crash with the following LogCat message:

java.lang.IllegalArgumentException: n <= 0: 0
    at java.util.Random.nextInt(Random.java:182)
    at com.google.developer.udacityalumni.service.AlumIntentService.addArticles(AlumIntentService.java:55)
    at com.google.developer.udacityalumni.service.AlumIntentService.onHandleIntent(AlumIntentService.java:109)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
    at android.os.Handler.dispatchMessage(Handler.java:111)
    at android.os.Looper.loop(Looper.java:207)
    at android.os.HandlerThread.run(HandlerThread.java:61)

Other Information

The problem appears to be caused on this line in AlumIntentService:

JSONArray tags = article.getJSONArray(KEY_TAGS);
int ind = new Random().nextInt(tags.length());

If tags has a length of zero, then the application crashes as the nextInt() method in Random cannot accept zero as an argument.

Checking the JSON file at http://udacity-alumni-api.herokuapp.com/api/v1/articles shows what's likely causing the problem (note the empty tags array):

    {
      "id": 11,
      "title": "my title",
      "featured": false,
      "spotlighted": true,
      "content": "yo this is my story\n",
      "feature_image": "",
      "status": "draft",
      "slug": "my-title",
      "user": {
        "id": 15,
        "email": "[email protected]",
        "created_at": "2017-01-25T09:33:40.858Z",
        "updated_at": "2017-01-25T09:43:34.337Z",
        "name": "noah hall",
        "avatar": null,
        "role": "user",
        "bio": "",
        "public": true
      },
      "created_at": "2017-01-25T10:41:15.683Z",
      "updated_at": "2017-01-25T10:41:15.709Z",
      "tags": [
        
      ]
    } 

Match exit animation to entry animation when opening Custom Tabs Browser

Steps to reproduce

Open the side navigation menu and select either My Classroom, Catlog or Success Stores to open the Chrome Custom Tabs browser. The browser will animate in by sliding from the right side of the screen to the left. Then exit by pressing back, and a different animation is used that is part-translation and part-fade.

It would be better to match the exit animation so it is a true reversal of the entry animation.

enter-exit-chrome-tab-anim

add_share_article_button_click

Steps to reproduce

What are steps we can follow to reproduce this issue?

Expected behavior

What did you expected to happen?

Actual behavior

What did happened instead?
e.g. the stack trace of a crash

Code Sample

Provide a code sample or test case that highlights the issue.
If relevant, include your model definitions.
For larger code samples, links to external gists / repositories are preferred.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.