Skip to content

Commit

Permalink
Home fragment and farmerlist added.
Browse files Browse the repository at this point in the history
  • Loading branch information
initishh committed Jun 2, 2019
1 parent 8124dd4 commit 3e4afe0
Show file tree
Hide file tree
Showing 17 changed files with 404 additions and 72 deletions.
6 changes: 6 additions & 0 deletions NudgeRewriten/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions NudgeRewriten/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.rhexgomez.typer:typer-roboto:2.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.vipulasri:timelineview:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
37 changes: 27 additions & 10 deletions NudgeRewriten/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.nudgerewriten">

<uses-permission android:name="android.permission.VIBRATE" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="Nudge"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activities.SplashScreenActivity" android:theme="@style/AppTheme1">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".activities.LoginActivity" android:theme="@style/AppTheme1"/>
<activity android:name=".activities.MainActivity" android:theme="@style/AppTheme1" />
android:theme="@style/AppTheme"
tools:replace="android:label">
<activity android:name=".activities.CropTimeLineActivity"></activity>
<activity android:name=".activities.ScheduleCropActivity" />
<activity
android:name=".activities.FarmerProfileActivity"
android:theme="@style/FarmerStyle" />
<activity android:name=".activities.NewVisitActivity" />
<activity android:name=".activities.OrdersActivity" />
<activity android:name=".activities.VisitsActivity" />
<activity
android:name=".activities.SplashScreenActivity"
android:theme="@style/AppTheme1">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.LoginActivity"
android:theme="@style/AppTheme" />
<activity android:name=".activities.MainActivity" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ public void afterTextChanged(Editable s) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
sharedPrefUtils.writeLoginStatus(true);

}
}
};

@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.os.Bundle;
import android.view.MenuItem;
import android.support.design.widget.BottomNavigationView;
import android.view.Window;
import android.view.WindowManager;

import com.example.nudgerewriten.R;
import com.example.nudgerewriten.fragments.CropAndMarketFragment;
Expand All @@ -23,7 +25,13 @@ protected void onCreate(Bundle savedInstanceState) {
BottomNavigationView botNav = findViewById(R.id.bottom_navigation);
botNav.setOnNavigationItemSelectedListener(navlistener);

//For initial fragment display
// Setting the status bar color to PrimaryDark for all fragments

Window window = this.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(this.getResources().getColor(R.color.colorPrimaryDark));

getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new HomeFragment()).commit();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class CropAndMarketFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragement_crop_and_market, container, false);
return inflater.inflate(R.layout.fragment_crop_and_market, container, false);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
package com.example.nudgerewriten.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.example.nudgerewriten.R;
import com.example.nudgerewriten.adapters.Adapter_contact_list_1;

import java.util.Arrays;

public class FarmerListFragment extends Fragment {

FloatingActionButton fabAdd;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragement_farmerlist, container, false);
return inflater.inflate(R.layout.fragment_farmerlist, container, false);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

RecyclerView farmer_contact_recycler =view.findViewById(R.id.farmer_contact_recycler);
fabAdd = view.findViewById(R.id.fab_add);

fabAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getContext(), "Add the farmer.", Toast.LENGTH_SHORT).show();
}
});

farmer_contact_recycler.setLayoutManager(new LinearLayoutManager(view.getContext()));
String[] data = {"Ankit Singh","Priyanka Patil","Aman Mohanty","Krishna Pati","Adyusha Pradhan","Rahul Gupta","Rohit Singh","Kapoora Todo","Dest 4","Eest 5","Fest 6","Gest 7","Hest 8","Iest 9"};
Arrays.sort(data);
farmer_contact_recycler.setAdapter(new Adapter_contact_list_1(data));

}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,76 @@
package com.example.nudgerewriten.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.nudgerewriten.R;
import com.example.nudgerewriten.activities.OrdersActivity;
import com.example.nudgerewriten.activities.VisitsActivity;
import com.example.nudgerewriten.adapters.ProductAdapter;

import java.util.ArrayList;
import java.util.List;

public class HomeFragment extends Fragment {

RecyclerView prodRcvId;
TextView visitId,orderId;
List<String> Products = new ArrayList<>();

ProductAdapter adapter;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home, container, false);
View v = inflater.inflate(R.layout.fragment_home, container, false);
setHasOptionsMenu(true);

for(int i =1;i<=6;i++)
Products.add("Product "+i);
return v;
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.home_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

prodRcvId = getView().findViewById(R.id.prod_rcv_id);
orderId = getView().findViewById(R.id.order_id);
visitId = getView().findViewById(R.id.visit_id);

prodRcvId.setLayoutManager(new GridLayoutManager(getActivity(),2,GridLayoutManager.HORIZONTAL,false));
adapter = new ProductAdapter(Products,getActivity());
prodRcvId.setAdapter(adapter);

orderId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getActivity(), OrdersActivity.class));
}
});

visitId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getActivity(), VisitsActivity.class));
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
package com.example.nudgerewriten.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.nudgerewriten.R;
import com.rhexgomez.typer.roboto.TyperRoboto;

public class ProfileFragment extends Fragment {

private static CollapsingToolbarLayout collapsingToolbarLayout;

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragement_profile, container, false);
return inflater.inflate(R.layout.fragment_profile, container, false);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

collapsingToolbarLayout = view.findViewById(R.id.collapsing_toolbar);

collapsingToolbarLayout.setCollapsedTitleTypeface(TyperRoboto.ROBOTO_REGULAR());
collapsingToolbarLayout.setExpandedTitleTypeface(TyperRoboto.ROBOTO_REGULAR());
}
}
2 changes: 1 addition & 1 deletion NudgeRewriten/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout 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"
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions NudgeRewriten/app/src/main/res/layout/fragement_farmerlist.xml

This file was deleted.

13 changes: 0 additions & 13 deletions NudgeRewriten/app/src/main/res/layout/fragement_profile.xml

This file was deleted.

Loading

0 comments on commit 3e4afe0

Please sign in to comment.