-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7098c1b
commit 33df66a
Showing
5 changed files
with
81 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
63 changes: 33 additions & 30 deletions
63
app/src/main/java/ir/khanbeiki/superviewpager/sample/FrgDashboard.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,65 +1,68 @@ | ||
package ir.khanbeiki.superviewpager.sample; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ProgressBar; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
|
||
|
||
import ir.khanbeiki.superviewpager.SuperViewPagerListener; | ||
|
||
public class FrgDashboard extends Fragment implements SuperViewPagerListener { | ||
|
||
private View rootView; | ||
private Context context; | ||
private Activity activity; | ||
|
||
private ProgressBar prgCommandDo; | ||
private ProgressBar prgAlwaysDo; | ||
private TextView txtTitle; | ||
private String name; | ||
@Override | ||
public void onFragmentCommandDo() { | ||
runView(); | ||
total = 0; | ||
updateProgressBar(prgCommandDo); | ||
} | ||
|
||
@Override | ||
public void onFragmentAlwaysDo() { | ||
alwaysRunView(); | ||
total = 0; | ||
updateProgressBar(prgAlwaysDo); | ||
} | ||
|
||
@Override | ||
public void onAttach(Context context) { | ||
super.onAttach(context); | ||
this.context = context; | ||
this.activity = getActivity(); | ||
public FrgDashboard(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public void onDetach() { | ||
super.onDetach(); | ||
context = null; | ||
activity = null; | ||
} | ||
|
||
private void alwaysRunView() { | ||
|
||
} | ||
private void runView() { | ||
|
||
private int total; | ||
private Handler handler; | ||
private void updateProgressBar(final ProgressBar progressBar) { | ||
if (total < 100) { | ||
handler = new Handler(); | ||
handler.postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
progressBar.setProgress(total++); | ||
updateProgressBar(progressBar); | ||
} | ||
}, 100); | ||
} | ||
} | ||
|
||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
|
||
prgCommandDo = view.findViewById(R.id.prgCommandDo); | ||
prgAlwaysDo = view.findViewById(R.id.prgAlwaysDo); | ||
txtTitle = view.findViewById(R.id.txtTitle); | ||
txtTitle.setText(name); | ||
} | ||
|
||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
return inflater.inflate(R.layout.frg_dashboard, container, false); | ||
} | ||
} | ||
|
||
} |
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