Commit 1f83f2f8 authored by isnirp's avatar isnirp

UseCases implemented

parent f1b9831d
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="imageWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="imageAssetPanel">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="actionbar">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_event_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputName" value="ic_action_cal" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="outputIconType" value="ACTIONBAR" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
......@@ -25,7 +25,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -28,6 +28,7 @@ dependencies {
implementation project(":qi-data")
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation "junit:junit:$rootProject.ext.junitVersion"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
......@@ -40,18 +41,19 @@ dependencies {
//picasso
implementation "com.squareup.picasso:picasso:$rootProject.ext.picassoVersion"
//calendar
implementation 'com.riontech:calendar:1.0'
//gson
implementation "com.google.code.gson:gson:$rootProject.ext.gsonVersion"
//retrofit
implementation "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.ext.retrofitVersion"
//dependency injection
//implementation "com.google.dagger:dagger:$rootProject.ext.daggerVersion"
// apt 'com.google.dagger:dagger-compiler:2.8'
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.ext.daggerVersion"
implementation "com.google.dagger:dagger:$rootProject.ext.daggerVersion"
//circle img
implementation 'de.hdodenhof:circleimageview:1.2.2'
//rx
implementation "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxjavaVersion"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
......
......@@ -17,7 +17,8 @@
</intent-filter>
</activity>
<activity android:name=".ui.profile.ProfileActivity" />
<activity android:name=".ui.events.EventsActivity"></activity>
<activity android:name=".ui.events.EventsActivity" />
<activity android:name=".ui.courses.CourseActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -3,18 +3,104 @@ package com.flimbis.qi;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.flimbis.qi.ui.events.EventsActivity;
import com.flimbis.qi.ui.home.MainPresenter;
import com.flimbis.qi.ui.home.ViewContract;
import com.flimbis.qi.ui.profile.ProfileActivity;
public class MainActivity extends AppCompatActivity {
import de.hdodenhof.circleimageview.CircleImageView;
public class MainActivity extends AppCompatActivity implements ViewContract.View {
private Toolbar toolbar;
private CircleImageView profileImage;
private RecyclerView recyclerView;
MainPresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme_Def);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initViews();
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
}
@Override
protected void onResume() {
super.onResume();
/* profileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
presenter.navigateToProfile();
}
});*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_cal:
Intent intent = new Intent(this, EventsActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_from_right /*enterAnimationId*/, R.anim.slide_to_left/*exitAnimationId*/);
// presenter.navigateToEvents();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void showDashboard() {
}
@Override
public void showProfile() {
Intent intent = new Intent(this, ProfileActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_from_right /*enterAnimationId*/, R.anim.slide_to_left/*exitAnimationId*/);
}
@Override
public void showEvents() {
Intent intent = new Intent(this, EventsActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.slide_from_right/*enterAnimationId*/, R.anim.slide_to_left/*exitAnimationId*/);
overridePendingTransition(R.anim.slide_from_right /*enterAnimationId*/, R.anim.slide_to_left/*exitAnimationId*/);
}
@Override
public boolean isLogin() {
return false;
}
@Override
public boolean isNetworkAvailable() {
return false;
}
@Override
public void showMessage(String msg, String type) {
}
private void initViews() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
profileImage = findViewById(R.id.img_prof);
recyclerView = findViewById(R.id.recy_main);
}
}
package com.flimbis.qi.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.flimbis.qi.R;
import de.hdodenhof.circleimageview.CircleImageView;
public class AgendaStreakAdapter extends RecyclerView.Adapter<AgendaStreakAdapter.ViewHolder>{
private Context context;
public AgendaStreakAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.items_agenda,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
public class ViewHolder extends RecyclerView.ViewHolder {
private CircleImageView alert;
private TextView day;
public ViewHolder(View itemView) {
super(itemView);
day = itemView.findViewById(R.id.txt_agenda_day);
alert = itemView.findViewById(R.id.img_agenda_alert);
}
}
}
package com.flimbis.qi.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.flimbis.qi.R;
public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder>{
private Context context;
private final int AGENDA = 0;
private final int COURSE = 1;
private final int TODO_TASK = 2;
public HomeAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
}
@Override
public int getItemCount() {
return 0;
}
public class ViewHolder extends RecyclerView.ViewHolder{
private TextView title;
private TextView date;
public ViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.txt_main_title);
date = itemView.findViewById(R.id.txt_main_date);
}
}
}
package com.flimbis.qi.adapter;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import java.util.ArrayList;
import java.util.List;
public class ProfileTabAdapter extends FragmentStatePagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>();
private final List<String> fragmentTitleList = new ArrayList<>();
public ProfileTabAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Nullable
@Override
public CharSequence getPageTitle(int position) {
return fragmentTitleList.get(position);
}
public void addFragment(Fragment fragment, String title) {
fragmentList.add(fragment);
fragmentTitleList.add(title);
}
}
package com.flimbis.qi.ui.courses;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.flimbis.qi.R;
/**
* A simple {@link Fragment} subclass.
*/
public class ChatFragment extends Fragment {
public ChatFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_chat, container, false);
}
}
package com.flimbis.qi.ui.courses;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.flimbis.qi.R;
public class CourseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_course);
}
}
package com.flimbis.qi.ui.courses;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.flimbis.qi.R;
/**
* A simple {@link Fragment} subclass.
*/
public class CourseFragment extends Fragment {
public CourseFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_course, container, false);
}
}
......@@ -5,13 +5,24 @@ import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.flimbis.qi.R;
import com.riontech.calendar.CustomCalendar;
public class EventsActivity extends AppCompatActivity {
private CustomCalendar customCalendar;
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.AppTheme_Def);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_events);
customCalendar = (CustomCalendar) findViewById(R.id.customCalendar);
String[] arr = {"2016-06-10", "2016-06-11", "2016-06-15", "2016-06-16", "2016-06-25"};
for (int i = 0; i < 5; i++) {
int eventCount = 3;
//customCalendar.addAnEvent(arr[i], eventCount, getEventDataList(eventCount));
}
}
@Override
......
package com.flimbis.qi.ui.events;
public interface EventsViewContract {
interface View {
void showMessage(String msg, String type);
}
interface Presenter {
void unbind();
}
}
package com.flimbis.qi.ui.home;
import javax.inject.Inject;
public class MainPresenter implements ViewContract.Presenter {
private ViewContract.View view;
@Inject
public MainPresenter(ViewContract.View view) {
this.view = view;
}
@Override
public void load() {
}
@Override
public void navigateToProfile() {
view.showProfile();
}
@Override
public void navigateToEvents() {
view.showEvents();
}
@Override
public void unBind() {
view = null;
//usecase.dispose();
}
}
package com.flimbis.qi.ui.home;
public interface ViewContract {
interface View {
void showDashboard();
void showProfile();
void showEvents();
boolean isLogin();
boolean isNetworkAvailable();
void showMessage(String msg, String type);
}
interface Presenter {
void load();
void navigateToProfile();
void navigateToEvents();
void unBind();
}
}
package com.flimbis.qi.ui.profile;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.flimbis.qi.R;
import com.flimbis.qi.adapter.ProfileTabAdapter;
import com.flimbis.qi.ui.courses.ChatFragment;
import com.flimbis.qi.ui.courses.CourseFragment;
public class ProfileActivity extends AppCompatActivity {
private ProfileTabAdapter adapter;
private TabLayout tabLayout;
private ViewPager viewPager;
public ProfileActivity() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
viewPager = (ViewPager) findViewById(R.id.viewPager);
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
adapter = new ProfileTabAdapter(getSupportFragmentManager());
adapter.addFragment(new CourseFragment(), "Tab 1");
adapter.addFragment(new ChatFragment(), "Tab 2");
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
}
}
<?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=".ui.courses.CourseActivity">
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
......@@ -6,8 +6,12 @@
android:layout_height="match_parent"
tools:context=".ui.events.EventsActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="events"/>
<com.riontech.calendar.CustomCalendar
android:id="@+id/customCalendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:endMonth="07"
app:endYear="2016"
app:startMonth="01"
app:startYear="2016" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/toolbar"
layout="@layout/app_bar" />
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<android.support.v7.widget.RecyclerView
android:id="@+id/recy_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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=".ui.profile.ProfileActivity">
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
<include
android:id="@+id/toolbar_prof"
layout="@layout/app_bar" />
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="events"/>
android:minHeight="?actionBarSize"
app:tabBackground="?themePrimary"
app:tabGravity="fill"
app:tabIndicatorColor="?themeTextColorSecondary"
app:tabIndicatorHeight="4dp"
app:tabMode="fixed"></android.support.design.widget.TabLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"