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
import android.annotation.SuppressLint; | |
import android.content.ContentUris; | |
import android.content.Context; | |
import android.content.CursorLoader; | |
import android.database.Cursor; | |
import android.net.Uri; | |
import android.os.Build; | |
import android.os.Environment; | |
import android.provider.DocumentsContract; | |
import android.provider.MediaStore; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/parent_layout" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_margin="10dp" | |
android:layout_marginTop="16dp" | |
android:background="@color/colorPrimary" | |
android:orientation="vertical" | |
android:padding="20dp" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recycler_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_marginLeft="8dp" |
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
public class Task implements Runnable { | |
public static final String TAG = "RUNANABLE"; | |
private String taskName; | |
private Context mContext; | |
private ProgressBar progressBar; | |
private TextView statusTextView; | |
public Task(Context mContext, String taskName, ProgressBar progressBar, TextView statusTextView) { |
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
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder> { | |
private ArrayList<String> mTaskNames; | |
private Context mContext; | |
public RecyclerViewAdapter(Context mContext, ArrayList<String> mTaskNames) { | |
this.mTaskNames = mTaskNames; | |
this.mContext = mContext; | |
} |
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
public class Manager { | |
private static final int CORE_POOL_SIZE = 5; | |
private static final int MAX_POOL_SIZE = 10; | |
private static final int KEEP_ALIVE_TIME = 50; | |
private static Manager managerInstance = null; | |
//Queue for all the Tasks | |
final BlockingQueue<Runnable> WorkQueue; |
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
package elixer.com.threadpool; | |
public class MainActivity extends AppCompatActivity { | |
private ArrayList<String> mTaskNames = new ArrayList<>(); | |
private RecyclerView recyclerView; | |
private RecyclerView.Adapter mAdapter; | |
private RecyclerView.LayoutManager layoutManager; | |
@Override |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:paddingTop="200dp"> | |
<Button | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" |
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
public class App extends Application { | |
public static final String CHANNEL_ID = "exampleServiceChannel"; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
createNotificationChannel(); | |
} | |
private void createNotificationChannel() { |
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
public class MainActivity extends AppCompatActivity { | |
private Button startServiceButton; | |
private Button stopServiceButton; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
startServiceButton = findViewById(R.id.start_button); |
OlderNewer