2424import bot .box .appusage .utils .Duration ;
2525import bot .box .appusage .utils .UsageUtils ;
2626
27- public class MainActivity extends AppCompatActivity implements UsageContracts .View
28- , PackageContracts .View , AdapterView .OnItemSelectedListener {
27+ public class MainActivity extends AppCompatActivity implements UsageContracts .View ,
28+ PackageContracts .View , AdapterView .OnItemSelectedListener {
2929
30- private RecyclerView mRecycler ;
3130 private AppAdapter mAdapter ;
3231
33- private TextView tvUsageStatus , tv_totalUsage ;
34-
3532 @ Override
3633 protected void onCreate (Bundle savedInstanceState ) {
3734 super .onCreate (savedInstanceState );
3835 setContentView (R .layout .activity_main );
3936
40-
4137 Monitor .scan ().queryFor (this ).whichPackage ("com.whatsapp" ).
4238 fetchFor (Duration .TODAY );//check usage for specific package.
4339 }
@@ -54,10 +50,8 @@ protected void onResume() {
5450 }
5551
5652 private void init () {
57- mRecycler = findViewById (R .id .recycler );
58- tvUsageStatus = findViewById (R .id .tv_UsageStatus );
53+ RecyclerView mRecycler = findViewById (R .id .recycler );
5954 mAdapter = new AppAdapter (this );
60- tv_totalUsage = findViewById (R .id .tv_totalUsage );
6155
6256 Spinner spinner = findViewById (R .id .spinner );
6357 spinner .setVisibility (View .VISIBLE );
@@ -88,6 +82,7 @@ public void showProgress() {
8882 @ Override
8983 public void hideProgress () {
9084 }
85+
9186 /**
9287 * @param usageData list of application that has been within the duration for which query has been made.
9388 * @param mTotalUsage a sum total of the usage by each and every app with in the request duration.
@@ -101,7 +96,7 @@ public void getUsageData(List<AppData> usageData, long mTotalUsage, int duration
10196
10297 @ Override
10398 public void getUsageForPackage (String mPackage , long mTotalUsage , int duration ) {
104- System .out .println ("Usage for " + mPackage + " is : " + UsageUtils .humanReadableMillis (mTotalUsage )
105- + " for " + Duration .getCurrentReadableDay (duration ));
99+ System .out .println ("Usage for " + mPackage + " is : " + UsageUtils .humanReadableMillis (mTotalUsage )
100+ + " for " + Duration .getCurrentReadableDay (duration ));
106101 }
107102}
0 commit comments