Add gridview (not working)
@ -18,7 +18,7 @@ import io.github.wulkanowy.activity.dashboard.marks.MarksFragment;
|
|||||||
public class DashboardActivity extends AppCompatActivity {
|
public class DashboardActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
|
||||||
MarksFragment marksFragment = new MarksFragment();
|
MarksFragment marksFragment;
|
||||||
AttendanceFragment attendanceFragment = new AttendanceFragment();
|
AttendanceFragment attendanceFragment = new AttendanceFragment();
|
||||||
BoardFragment boardFragment = new BoardFragment();
|
BoardFragment boardFragment = new BoardFragment();
|
||||||
LessonplanFragment lessonplanFragment = new LessonplanFragment();
|
LessonplanFragment lessonplanFragment = new LessonplanFragment();
|
||||||
@ -68,6 +68,8 @@ public class DashboardActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_dashboard);
|
setContentView(R.layout.activity_dashboard);
|
||||||
|
|
||||||
|
marksFragment = new MarksFragment();
|
||||||
|
|
||||||
setTitle(R.string.title_dashboard);
|
setTitle(R.string.title_dashboard);
|
||||||
|
|
||||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package io.github.wulkanowy.activity.dashboard.marks;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.GridView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.R;
|
||||||
|
|
||||||
|
public class ImageAdapter extends BaseAdapter {
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
|
public ImageAdapter(Context c) {
|
||||||
|
this.mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return mThumbIds.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a new ImageView for each item referenced by the Adapter
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
ImageView imageView;
|
||||||
|
if (convertView == null) {
|
||||||
|
// if it's not recycled, initialize some attributes
|
||||||
|
imageView = new ImageView(mContext);
|
||||||
|
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
|
||||||
|
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
|
imageView.setPadding(8, 8, 8, 8);
|
||||||
|
} else {
|
||||||
|
imageView = (ImageView) convertView;
|
||||||
|
}
|
||||||
|
|
||||||
|
imageView.setImageResource(mThumbIds[position]);
|
||||||
|
return imageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
// references to our images
|
||||||
|
private Integer[] mThumbIds = {
|
||||||
|
R.drawable.sample_2, R.drawable.sample_3,
|
||||||
|
R.drawable.sample_4, R.drawable.sample_5,
|
||||||
|
R.drawable.sample_6, R.drawable.sample_7,
|
||||||
|
R.drawable.sample_0, R.drawable.sample_1,
|
||||||
|
R.drawable.sample_2, R.drawable.sample_3,
|
||||||
|
R.drawable.sample_4, R.drawable.sample_5,
|
||||||
|
R.drawable.sample_6, R.drawable.sample_7,
|
||||||
|
R.drawable.sample_0, R.drawable.sample_1,
|
||||||
|
R.drawable.sample_2, R.drawable.sample_3,
|
||||||
|
R.drawable.sample_4, R.drawable.sample_5,
|
||||||
|
R.drawable.sample_6, R.drawable.sample_7
|
||||||
|
};
|
||||||
|
}
|
@ -1,16 +1,30 @@
|
|||||||
package io.github.wulkanowy.activity.dashboard.marks;
|
package io.github.wulkanowy.activity.dashboard.marks;
|
||||||
|
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.GridView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
|
|
||||||
|
|
||||||
import io.github.wulkanowy.R;
|
import io.github.wulkanowy.R;
|
||||||
|
|
||||||
public class MarksFragment extends Fragment {
|
public class MarksFragment extends Fragment {
|
||||||
|
|
||||||
|
Activity mActivity;
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
mActivity = (Activity) context;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public MarksFragment() {
|
public MarksFragment() {
|
||||||
}
|
}
|
||||||
@ -19,6 +33,18 @@ public class MarksFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
View view = inflater.inflate(R.layout.fragment_marks, container, false);
|
||||||
|
|
||||||
|
GridView gridview = (GridView) view.findViewById(R.id.gridview);
|
||||||
|
gridview.setAdapter(new ImageAdapter(mActivity));
|
||||||
|
|
||||||
|
gridview.setOnItemClickListener(new OnItemClickListener() {
|
||||||
|
public void onItemClick(AdapterView<?> parent, View v,
|
||||||
|
int position, long id) {
|
||||||
|
Toast.makeText(mActivity,"HALLO", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
return inflater.inflate(R.layout.fragment_marks, container, false);
|
return inflater.inflate(R.layout.fragment_marks, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public class LoadingTask extends AsyncTask<Void, Void, Void> {
|
|||||||
/* Intent intent = new Intent(activity,MainActivity.class);
|
/* Intent intent = new Intent(activity,MainActivity.class);
|
||||||
activity.startActivity(intent); */
|
activity.startActivity(intent); */
|
||||||
|
|
||||||
Intent intent = new Intent(activity,MainActivity.class);
|
Intent intent = new Intent(activity,DashboardActivity.class);
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable/sample_0.jpg
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
app/src/main/res/drawable/sample_1.jpg
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
app/src/main/res/drawable/sample_2.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
app/src/main/res/drawable/sample_3.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
app/src/main/res/drawable/sample_4.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
app/src/main/res/drawable/sample_5.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
app/src/main/res/drawable/sample_6.jpg
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
app/src/main/res/drawable/sample_7.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
@ -1,17 +1,18 @@
|
|||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context="io.github.wulkanowy.activity.dashboard.marks.MarksFragment">
|
||||||
|
|
||||||
|
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/gridview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="io.github.wulkanowy.activity.dashboard.marks.MarksFragment">
|
android:columnWidth="90dp"
|
||||||
|
android:numColumns="auto_fit"
|
||||||
|
android:verticalSpacing="10dp"
|
||||||
<TextView
|
android:horizontalSpacing="10dp"
|
||||||
android:layout_width="match_parent"
|
android:gravity="center"
|
||||||
android:layout_height="match_parent"
|
/>
|
||||||
android:text="Fragment Oceny" />
|
|
||||||
|
|
||||||
<ExpandableListView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|