Skip to content

Commit

Permalink
chore: move content from fragment to activity
Browse files Browse the repository at this point in the history
EdricChan03 committed Mar 21, 2018
1 parent ad5a050 commit b687f1d
Showing 3 changed files with 37 additions and 88 deletions.
37 changes: 37 additions & 0 deletions app/src/main/java/com/edricchan/studybuddy/MainActivity.java
Original file line number Diff line number Diff line change
@@ -13,8 +13,11 @@
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -42,12 +45,14 @@ public class MainActivity extends AppCompatActivity implements GoogleApiClient.O
static final int ACTION_NEW_TASK = 1;
private static final String ACTION_ADD_NEW_TODO = "com.edricchan.studybuddy.shortcuts.ADD_NEW_TODO";
final Context context = this;
private final ArrayList taskItems = new ArrayList<>();
private int testInt, RC_SIGN_IN;
private FirebaseAuth mAuth;
private GoogleApiClient mGoogleApiClient;
private String userName;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private FirebaseUser currentUser;
private RecyclerView.Adapter mAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -104,6 +109,38 @@ public void onClick(View view) {
}
});

// Handles swiping down to refresh logic
final SwipeRefreshLayout swipeRefreshLayout = findViewById(R.id.recycler_swiperefresh);
// Sets a refreshing listener
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mAdapter.notifyDataSetChanged();
new android.os.Handler().postDelayed(
new Runnable() {
@Override
public void run() {
swipeRefreshLayout.setRefreshing(false);

}
},
1000);
}
});
RecyclerView mRecyclerView = findViewById(R.id.recycler_list);

// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);

// use a linear layout manager
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);

// specify an adapter (see also next example)
//noinspection unchecked
mAdapter = new StudyAdapter(this, taskItems);
mRecyclerView.setAdapter(mAdapter);
// Check if Android Oreo
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setupNotificationChannels();
66 changes: 0 additions & 66 deletions app/src/main/java/com/edricchan/studybuddy/TodoFragment.java

This file was deleted.

22 changes: 0 additions & 22 deletions app/src/main/res/layout/content_main.xml

This file was deleted.

0 comments on commit b687f1d

Please sign in to comment.