Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from ome450901/develop
Develop
- Loading branch information
Showing
25 changed files
with
161 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
example/src/androidTest/java/com/willy/example/ExampleInstrumentedTest.java
This file was deleted.
Oops, something went wrong.
65 changes: 26 additions & 39 deletions
65
example/src/main/java/com/willy/example/DemoFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,59 @@ | ||
package com.willy.example; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.RatingBar; | ||
import android.widget.RatingBar.OnRatingBarChangeListener; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.Fragment; | ||
|
||
import com.willy.ratingbar.BaseRatingBar; | ||
import com.willy.ratingbar.RotationRatingBar; | ||
import com.willy.ratingbar.ScaleRatingBar; | ||
|
||
public class DemoFragment extends Fragment { | ||
public class DemoFragment | ||
extends Fragment { | ||
|
||
public static final String TAG = "SimpleRatingBar"; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, | ||
@Nullable Bundle savedInstanceState) { | ||
return inflater.inflate(R.layout.fragment_demo, container, false); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
|
||
final BaseRatingBar baseRatingBar = (BaseRatingBar) view.findViewById(R.id.baseratingbar_main); | ||
final ScaleRatingBar scaleRatingBar = (ScaleRatingBar) view.findViewById(R.id.scaleRatingBar); | ||
final RotationRatingBar rotationRatingBar = (RotationRatingBar) view.findViewById(R.id.rotationratingbar_main); | ||
final BaseRatingBar baseRatingBar = view.findViewById(R.id.baseratingbar_main); | ||
final ScaleRatingBar scaleRatingBar = view.findViewById(R.id.scaleRatingBar); | ||
final RotationRatingBar rotationRatingBar = view.findViewById(R.id.rotationratingbar_main); | ||
baseRatingBar.setClearRatingEnabled(false); | ||
baseRatingBar.setOnRatingChangeListener(new BaseRatingBar.OnRatingChangeListener() { | ||
@Override | ||
public void onRatingChange(BaseRatingBar ratingBar, float rating, boolean fromUser) { | ||
Log.d(TAG, "BaseRatingBar onRatingChange: " + rating); | ||
} | ||
}); | ||
baseRatingBar.setOnRatingChangeListener((ratingBar, rating, fromUser) -> Log | ||
.d(TAG, "BaseRatingBar onRatingChange: " + rating)); | ||
|
||
scaleRatingBar.setOnRatingChangeListener(new BaseRatingBar.OnRatingChangeListener() { | ||
@Override | ||
public void onRatingChange(BaseRatingBar ratingBar, float rating, boolean fromUser) { | ||
Log.d(TAG, "ScaleRatingBar onRatingChange: " + rating); | ||
} | ||
}); | ||
scaleRatingBar.setOnRatingChangeListener((ratingBar, rating, fromUser) -> Log | ||
.d(TAG, "ScaleRatingBar onRatingChange: " + rating)); | ||
|
||
rotationRatingBar.setOnRatingChangeListener(new BaseRatingBar.OnRatingChangeListener() { | ||
@Override | ||
public void onRatingChange(BaseRatingBar ratingBar, float rating, boolean fromUser) { | ||
Log.d(TAG, "RotationRatingBar onRatingChange: " + rating); | ||
} | ||
}); | ||
rotationRatingBar.setOnRatingChangeListener((ratingBar, rating, fromUser) -> Log | ||
.d(TAG, "RotationRatingBar onRatingChange: " + rating)); | ||
|
||
Button addRatingButton = (Button) view.findViewById(R.id.button_main_add_rating); | ||
addRatingButton.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
float currentRating = baseRatingBar.getRating(); | ||
baseRatingBar.setRating(currentRating + 0.25f); | ||
Button addRatingButton = view.findViewById(R.id.button_main_add_rating); | ||
addRatingButton.setOnClickListener(v -> { | ||
float currentRating = baseRatingBar.getRating(); | ||
baseRatingBar.setRating(currentRating + 0.25f); | ||
|
||
currentRating = scaleRatingBar.getRating(); | ||
scaleRatingBar.setRating(currentRating + 0.25f); | ||
currentRating = scaleRatingBar.getRating(); | ||
scaleRatingBar.setRating(currentRating + 0.25f); | ||
|
||
currentRating = rotationRatingBar.getRating(); | ||
rotationRatingBar.setRating(currentRating + 0.25f); | ||
} | ||
currentRating = rotationRatingBar.getRating(); | ||
rotationRatingBar.setRating(currentRating + 0.25f); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
package com.willy.example; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
public class ListFragment extends Fragment { | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
public class ListFragment | ||
extends Fragment { | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, | ||
@Nullable Bundle savedInstanceState) { | ||
return inflater.inflate(R.layout.fragment_list, container, false); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView); | ||
RecyclerView recyclerView = view.findViewById(R.id.recyclerView); | ||
recyclerView.setAdapter(new MyAdapter(getContext())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.