Skip to content
Snippets Groups Projects
Commit 002558ed authored by iammaxx's avatar iammaxx
Browse files

prem check

parent 68b6d736
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ android {
defaultConfig {
applicationId "com.digitalar"
minSdkVersion 22
targetSdkVersion 25
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
......
......@@ -24,7 +24,8 @@
android:name=".AdmHome"
android:label="@string/title_activity_adm_home"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".Addclass"></activity>
<activity android:name=".Addclass" />
<activity android:name=".Choosecourse"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -8,6 +8,7 @@ import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
......@@ -17,11 +18,22 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;
public class AdmHome extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
......@@ -81,7 +93,8 @@ public class AdmHome extends AppCompatActivity
return super.onOptionsItemSelected(item);
}
List<String>classes = new ArrayList<String>(50);
List<String>courses = new ArrayList<String>(50);
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
......@@ -91,13 +104,57 @@ public class AdmHome extends AppCompatActivity
if (id == R.id.nav_class) {
// Handle the camera action
ItemFragment i1 = ItemFragment.newInstance(2);
mData.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
// String value = dataSnapshot.getValue(String.class);
HashMap<String, String> s3 = (HashMap) dataSnapshot.child("class").getValue();
Log.e("dede",s3.keySet().toString());
classes=new ArrayList<String>(50);
classes.addAll(s3.keySet());
//Log.d(TAG, "Value is: " + value);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
ItemFragment i1 = ItemFragment.newInstance(classes,getApplicationContext(),0);
FragmentTransaction f1 =getFragmentManager().beginTransaction();
f1.add(R.id.fra1,i1);
f1.replace(R.id.fra1,i1);
f1.commit();
} else if (id == R.id.nav_course)
{
mData.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
// String value = dataSnapshot.getValue(String.class);
HashMap<String, String> s3 = (HashMap) dataSnapshot.child("course").getValue();
Log.e("dede",s3.keySet().toString());
courses=new ArrayList<String>(50);
courses.addAll(s3.keySet());
//Log.d(TAG, "Value is: " + value);
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
ItemFragment i2 = ItemFragment.newInstance(courses,this,1);
FragmentTransaction f2 =getFragmentManager().beginTransaction();
f2.replace(R.id.fra1,i2);
f2.commit();
} else if (id == R.id.nav_slideshow) {
......@@ -112,6 +169,7 @@ public class AdmHome extends AppCompatActivity
return true;
}
Dialog d1;
public void fab(View view)
{
d1 = new Dialog(this);
......
package com.digitalar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Choosecourse extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choosecourse);
}
}
......@@ -9,6 +9,7 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.digitalar.dummy.DummyContent;
import com.digitalar.dummy.DummyContent.DummyItem;
......@@ -34,16 +35,21 @@ public class ItemFragment extends Fragment {
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
*/
static String[] args10;
public ItemFragment() {
}
static ArrayAdapter<String> adapter;
// TODO: Customize parameter initialization
@SuppressWarnings("unused")
public static ItemFragment newInstance(int columnCount) {
static List<String> s1;
static int state;
public static ItemFragment newInstance(List<String> s2,Context ct,int st) {
ItemFragment fragment = new ItemFragment();
Bundle args = new Bundle();
args.putInt(ARG_COLUMN_COUNT, columnCount);
args.putInt(ARG_COLUMN_COUNT, 1);
fragment.setArguments(args);
s1=s2;
state=st;
return fragment;
}
......@@ -70,11 +76,8 @@ public class ItemFragment extends Fragment {
} else {
recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
}
List<String>s1 = new ArrayList<>(20);
s1.add("hello");
s1.add("hi");
s1.add("bye");
recyclerView.setAdapter(new MyItemRecyclerViewAdapter(DummyContent.ITEMS, mListener));
recyclerView.setAdapter(new MyItemRecyclerViewAdapter(s1, mListener,getActivity().getApplicationContext(),state));
}
return view;
}
......@@ -110,6 +113,6 @@ public class ItemFragment extends Fragment {
*/
public interface OnListFragmentInteractionListener {
// TODO: Update argument type and name
void onListFragmentInteraction(DummyItem item);
void onListFragmentInteraction(String item);
}
}
package com.digitalar;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v4.view.MotionEventCompat;
import android.app.AlertDialog;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
......@@ -15,23 +21,28 @@ import com.digitalar.dummy.DummyContent.DummyItem;
import java.util.List;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
/**
* {@link RecyclerView.Adapter} that can display a {@link DummyItem} and makes a call to the
* specified {@link OnListFragmentInteractionListener}.
* TODO: Replace the implementation with code for your data type.
*/
public class MyItemRecyclerViewAdapter extends RecyclerView.Adapter<MyItemRecyclerViewAdapter.ViewHolder> {
private final List<DummyItem> mValues;
int state;
private final List<String> mValues;
private final OnListFragmentInteractionListener mListener;
public MyItemRecyclerViewAdapter(List<DummyItem> items, OnListFragmentInteractionListener listener) {
Context ct;
public MyItemRecyclerViewAdapter(List<String> items, OnListFragmentInteractionListener listener, Context c,int st) {
mValues = items;
mListener = listener;
ct=c;
state=st;
}
LayoutInflater lx;
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
lx=LayoutInflater.from(parent.getContext());
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fragment_item, parent, false);
return new ViewHolder(view);
......@@ -40,14 +51,22 @@ public class MyItemRecyclerViewAdapter extends RecyclerView.Adapter<MyItemRecycl
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.mItem = mValues.get(position);
holder.mIdView.setText(mValues.get(position).id);
holder.mContentView.setText(mValues.get(position).content);
holder.mContentView.setText(mValues.get(position));
holder.mView.setFocusable(true);
final Intent in= new Intent(ct,Choosecourse.class);
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Integer e1= holder.getAdapterPosition()+1;
Log.d("recycler",e1.toString());
Toast.makeText(ct, e1.toString(), Toast.LENGTH_SHORT).show();
if(state==0)
{ in.setFlags(FLAG_ACTIVITY_NEW_TASK);
ct.startActivity(in);}
else if(state==1)
di();
if (null != mListener) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
......@@ -56,6 +75,14 @@ public class MyItemRecyclerViewAdapter extends RecyclerView.Adapter<MyItemRecycl
}
});
}
Dialog d1;
public void di()
{
d1 = new Dialog(ct);
d1.setContentView(R.layout.deldia);
d1.show();
}
@Override
public int getItemCount() {
......@@ -64,14 +91,14 @@ public class MyItemRecyclerViewAdapter extends RecyclerView.Adapter<MyItemRecycl
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView mIdView;
public final TextView mContentView;
public DummyItem mItem;
public String mItem;
public ViewHolder(View view) {
super(view);
mView = view;
mIdView = (TextView) view.findViewById(R.id.id);
mContentView = (TextView) view.findViewById(R.id.content);
}
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.digitalar.Choosecourse">
</android.support.constraint.ConstraintLayout>
......@@ -40,7 +40,8 @@
android:hint="User name"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true"/>
android:singleLine="true"
android:text="spjn1234@gmail.com" />
</android.support.design.widget.TextInputLayout>
......@@ -58,7 +59,8 @@
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true"/>
android:singleLine="true"
android:text="12345678" />
</android.support.design.widget.TextInputLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="22dp"
android:text="Delete Course"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="39dp"
android:text="Are you sure You want to Delete The Course ?"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="18sp"
android:layout_below="@+id/textView6"
android:layout_centerHorizontal="true" />
<Button
android:id="@+id/button8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/textView6"
android:layout_below="@+id/textView7"
android:layout_marginTop="73dp"
android:onClick=""
android:text="Cancel" />
<Button
android:id="@+id/button9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/button8"
android:layout_marginStart="47dp"
android:layout_toEndOf="@+id/button8"
android:text="Delete" />
</RelativeLayout>
......@@ -2,30 +2,24 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="vertical">
<TextView
android:id="@+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
<android.support.v7.widget.CardView
android:layout_width="381dp"
android:layout_height="59dp" >
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="33dp" >
android:text=" Hello World Hello World Hello World"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" Hello World Hello World Hello World" />
</android.support.v7.widget.CardView>
android:text="________________________________________________" />
</LinearLayout>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment