Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speakers issue #15 #48

Closed
wants to merge 4 commits into from
Closed

Conversation

tanmaydixit
Copy link
Member

@tanmaydixit tanmaydixit commented Jun 25, 2018

Issue #15 solved credits @Hariram-R
dependencies made latest too.

@tanmaydixit tanmaydixit requested a review from Rushi98 June 25, 2018 18:25
private MaterialCardView cardView;


public static SpeakerCardFragment newInstance() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is unnecessary as no arguments are passed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check line 105 of home activity, it is being used there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be replaced simply by new SpeakerCardFragment() (Also, you don't have to write an empty constructor i.e. public SpeakerCardFragment(){}, the compiler does that automatically for you by default)


@Override
public void onClick(View view) {
Intent intentToSpeakersActivity = new Intent(view.getContext(), SpeakersActivity.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[just suggestion] action + type (= lauchSpeakersIntent) would've been better choice for var name

@Override
public void onResume() {
super.onResume();
cardView.setOnClickListener(this);
Copy link
Member

@Rushi98 Rushi98 Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this setOnClickListener to onCreate, and no need of cardView.setOnClickListener(null)

* */

public class SpeakersActivity extends FragmentActivity {
private ArrayList<String> nameList;
Copy link
Member

@Rushi98 Rushi98 Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create model for speakers and use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch the data in adapter

imageV = itemView.findViewById(R.id.speaker_image);
nameTV = itemView.findViewById(R.id.speaker_name);
descTV = itemView.findViewById(R.id.speaker_desc);
}
Copy link
Member

@Rushi98 Rushi98 Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a public method populate(Speker), populate the vh in that method. Also, set onClickListener in vh

@Override
public void onBindViewHolder(@NonNull final SpeakerViewHolder holder, final int position) {

holder.imageV.setImageURI(imgList.get(position));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to Adapter's populate method

@Override
public void onClick(View view) {
String url = clickList.get(position);
Intent intent = new Intent(Intent.ACTION_VIEW);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use custom tabs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are custom tabs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this linearlayout is useless, remove it and keep only rv

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha18'
classpath 'com.android.tools.build:gradle:3.2.0-beta01'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beta, finally 😯

tools:context=".speakers.SpeakersActivity">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/speakers_RV"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adapter can be set here in xml itself!

app:placeholderImage="@mipmap/ic_launcher_round"
app:roundAsCircle="true" />

<androidx.cardview.widget.CardView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the card, keep only tv, same for description

android:layout_marginTop="0dp"
android:layout_weight="3"
app:actualImageScaleType="fitCenter"
app:placeholderImage="@mipmap/ic_launcher_round"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep another image as placeholder (maybe person icon)

android:id="@+id/speaker_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 margin is default, remove this

android:layout_height="wrap_content"
android:layout_margin="1dp"

android:layout_weight="0.5"
Copy link
Member

@Rushi98 Rushi98 Jun 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the weight, same for desc

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="He is a cool guy."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace by tools:text="He is a cool guy.", same for name

app:actualImageScaleType="fitCenter"
app:placeholderImage="@mipmap/ic_launcher_round"
app:roundAsCircle="true" />

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO in next issue/pr, social links of the speaker here @tanmaydixit

@Rushi98
Copy link
Member

Rushi98 commented Jul 11, 2018

@tanmaydixit rebase to latest code

@Rushi98 Rushi98 mentioned this pull request Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants