Commit 01796b31 authored by isnirp's avatar isnirp

demo

parent b5b4b5c7
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<PersistentState> <PersistentState>
<option name="values"> <option name="values">
<map> <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" /> <entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/content/ic_add_black_24dp.xml" />
</map> </map>
</option> </option>
</PersistentState> </PersistentState>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</option> </option>
<option name="values"> <option name="values">
<map> <map>
<entry key="outputName" value="ic_action_cal" /> <entry key="outputName" value="ic_action_add" />
</map> </map>
</option> </option>
</PersistentState> </PersistentState>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -38,6 +38,8 @@ dependencies { ...@@ -38,6 +38,8 @@ dependencies {
implementation "com.android.support:design:$rootProject.ext.androidSupportVersion" implementation "com.android.support:design:$rootProject.ext.androidSupportVersion"
implementation "com.android.support:support-v4:$rootProject.ext.androidSupportVersion" implementation "com.android.support:support-v4:$rootProject.ext.androidSupportVersion"
implementation "com.android.support:appcompat-v7:$rootProject.ext.androidSupportVersion" implementation "com.android.support:appcompat-v7:$rootProject.ext.androidSupportVersion"
//firebase
implementation 'com.google.firebase:firebase-database:16.0.5'
//picasso //picasso
implementation "com.squareup.picasso:picasso:$rootProject.ext.picassoVersion" implementation "com.squareup.picasso:picasso:$rootProject.ext.picassoVersion"
...@@ -59,3 +61,5 @@ dependencies { ...@@ -59,3 +61,5 @@ dependencies {
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compileOnly 'javax.annotation:jsr250-api:1.0' compileOnly 'javax.annotation:jsr250-api:1.0'
} }
//Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
{
"project_info": {
"project_number": "458556553652",
"firebase_url": "https://qifirebaseproject-c45d8.firebaseio.com",
"project_id": "qifirebaseproject-c45d8",
"storage_bucket": "qifirebaseproject-c45d8.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:458556553652:android:4c81c9a5771e71d3",
"android_client_info": {
"package_name": "com.flimbis.qi"
}
},
"oauth_client": [
{
"client_id": "458556553652-noc0uv1kfu3795vrmbbt2ha16rhs0i7t.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.flimbis.qi",
"certificate_hash": "fc0e17a2635c30ed4c91c7785e99483a537a5320"
}
},
{
"client_id": "458556553652-hjgg5krvrt34rtickhvk5d486julk5ka.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCtc-hEuCiX6B-e9rLBQ6LMyWxM3cAIhqk"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "458556553652-hjgg5krvrt34rtickhvk5d486julk5ka.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package="com.flimbis.qi"> package="com.flimbis.qi">
<application <application
android:name=".QiApplication"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
...@@ -16,9 +17,11 @@ ...@@ -16,9 +17,11 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".ui.profile.ProfileActivity" /> <activity android:name=".ui.profile.ProfileActivity"
<activity android:name=".ui.events.EventsActivity" /> android:parentActivityName=".MainActivity"/>
<activity android:name=".ui.courses.CourseActivity"></activity> <activity android:name=".ui.events.EventsActivity"
android:parentActivityName=".MainActivity"/>
<activity android:name=".ui.courses.detail.CourseActivity"></activity>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -3,23 +3,38 @@ package com.flimbis.qi; ...@@ -3,23 +3,38 @@ package com.flimbis.qi;
import android.content.Intent; import android.content.Intent;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast;
import com.flimbis.qi.adapter.AgendaStreakAdapter;
import com.flimbis.qi.adapter.HomeAdapter;
import com.flimbis.qi.di.component.AppComponent;
import com.flimbis.qi.model.EventModel;
import com.flimbis.qi.ui.events.EventsActivity; import com.flimbis.qi.ui.events.EventsActivity;
import com.flimbis.qi.ui.home.MainPresenter; import com.flimbis.qi.ui.home.MainPresenter;
import com.flimbis.qi.ui.home.ViewContract; import com.flimbis.qi.ui.home.ViewContract;
import com.flimbis.qi.ui.profile.ProfileActivity; import com.flimbis.qi.ui.profile.ProfileActivity;
import java.util.List;
import javax.inject.Inject;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
public class MainActivity extends AppCompatActivity implements ViewContract.View { public class MainActivity extends AppCompatActivity implements ViewContract.View {
private Toolbar toolbar; private Toolbar toolbar;
private CircleImageView profileImage; private CircleImageView profileImage;
private RecyclerView recyclerView; private RecyclerView recyclerView;
private RecyclerView recyAgenda;
private HomeAdapter adapter;
private AgendaStreakAdapter agendaAdapter;
@Inject
MainPresenter presenter; MainPresenter presenter;
@Override @Override
...@@ -31,17 +46,23 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View ...@@ -31,17 +46,23 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View
initViews(); initViews();
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setTitle(""); getSupportActionBar().setTitle("");
getApplicationComponent().inject(this);
presenter.setView(this);
presenter.load();
} }
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
/* profileImage.setOnClickListener(new View.OnClickListener() { profileImage.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
presenter.navigateToProfile(); presenter.navigateToProfile();
} }
});*/ });
} }
@Override @Override
...@@ -57,23 +78,21 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View ...@@ -57,23 +78,21 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View
Intent intent = new Intent(this, EventsActivity.class); Intent intent = new Intent(this, EventsActivity.class);
startActivity(intent); 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*/);
// presenter.navigateToEvents(); // presenter.navigateToEvents();
return true; return true;
/* case android.R.id.home:
presenter.navigateToProfile();
return true;*/
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
@Override
public void showDashboard() {
}
@Override @Override
public void showProfile() { public void showProfile() {
Intent intent = new Intent(this, ProfileActivity.class); Intent intent = new Intent(this, ProfileActivity.class);
startActivity(intent); startActivity(intent);
overridePendingTransition(R.anim.slide_from_right /*enterAnimationId*/, R.anim.slide_to_left/*exitAnimationId*/); overridePendingTransition(R.anim.slide_from_left /*enterAnimationId*/, R.anim.slide_to_right/*exitAnimationId*/);
} }
@Override @Override
...@@ -83,6 +102,24 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View ...@@ -83,6 +102,24 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View
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 void showDashboard(List<EventModel> eventModelList) {
agendaAdapter = new AgendaStreakAdapter(this, eventModelList);
recyAgenda.setAdapter(agendaAdapter);
}
@Override
public void showRecentEvents(List<EventModel> eventModelList) {
for(EventModel model: eventModelList){
if(model.getAlias() == "mobserv"){
Toast.makeText(this,model.getName(), Toast.LENGTH_SHORT).show();
}
Log.i("MainAc",""+model.getAlias());
}
adapter = new HomeAdapter(this, eventModelList);
recyclerView.setAdapter(adapter);
}
@Override @Override
public boolean isLogin() { public boolean isLogin() {
return false; return false;
...@@ -95,6 +132,7 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View ...@@ -95,6 +132,7 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View
@Override @Override
public void showMessage(String msg, String type) { public void showMessage(String msg, String type) {
Toast.makeText(this,msg, Toast.LENGTH_SHORT).show();
} }
...@@ -102,5 +140,16 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View ...@@ -102,5 +140,16 @@ public class MainActivity extends AppCompatActivity implements ViewContract.View
toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar = (Toolbar) findViewById(R.id.toolbar);
profileImage = findViewById(R.id.img_prof); profileImage = findViewById(R.id.img_prof);
recyclerView = findViewById(R.id.recy_main); recyclerView = findViewById(R.id.recy_main);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
recyAgenda = findViewById(R.id.recy_agenda);
LinearLayoutManager horLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
recyAgenda.setLayoutManager(horLayoutManager);
} }
private AppComponent getApplicationComponent() {
return QiApplication.getInstance().getAppComponent();
}
} }
package com.flimbis.qi;
import android.app.Application;
import com.flimbis.qi.di.component.AppComponent;
import com.flimbis.qi.di.component.DaggerAppComponent;
import com.flimbis.qi.di.module.ApiModule;
import com.flimbis.qi.di.module.AppModule;
public class QiApplication extends Application {
private static QiApplication INSTANCE;
private static AppComponent appComponent;
public static QiApplication getInstance() {
INSTANCE = new QiApplication();
return INSTANCE;
}
@Override
public void onCreate() {
super.onCreate();
getAppComponent();
}
public AppComponent getAppComponent() {
if (appComponent == null) {
appComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.apiModule(new ApiModule("https://qifirebaseproject-c45d8.firebaseio.com/"))
.build();
}
return appComponent;
}
}
\ No newline at end of file
...@@ -9,14 +9,22 @@ import android.view.ViewGroup; ...@@ -9,14 +9,22 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.flimbis.qi.R; import com.flimbis.qi.R;
import com.flimbis.qi.model.EventModel;
import java.util.ArrayList;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
public class AgendaStreakAdapter extends RecyclerView.Adapter<AgendaStreakAdapter.ViewHolder>{ public class AgendaStreakAdapter extends RecyclerView.Adapter<AgendaStreakAdapter.ViewHolder>{
private Context context; private Context context;
private List<EventModel> items;
private String[] day = {"s","m","t","w","t","f","s"};
private List<String> days = new ArrayList<>();
public AgendaStreakAdapter(Context context) { public AgendaStreakAdapter(Context context, List<EventModel> items) {
this.context = context; this.context = context;
this.items = items;
} }
@NonNull @NonNull
...@@ -28,12 +36,12 @@ public class AgendaStreakAdapter extends RecyclerView.Adapter<AgendaStreakAdapte ...@@ -28,12 +36,12 @@ public class AgendaStreakAdapter extends RecyclerView.Adapter<AgendaStreakAdapte
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
EventModel model = items.get(position);
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return 0; return items.size();
} }
public class ViewHolder extends RecyclerView.ViewHolder { public class ViewHolder extends RecyclerView.ViewHolder {
......
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 com.flimbis.qi.model.CourseModel;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
public class CourseAdapter extends RecyclerView.Adapter<CourseAdapter.ViewHolder> {
private Context context;
private List<CourseModel> items;
public CourseAdapter(Context context, List<CourseModel> items) {
this.context = context;
this.items = items;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.items_general, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
CourseModel course = items.get(position);
holder.title.setText(course.getAlias());
}
@Override
public int getItemCount() {
return items.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
TextView title;
CircleImageView img;
public ViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.txt_gen_title);
img = itemView.findViewById(R.id.img_gen_icon);
}
}
}
...@@ -2,48 +2,132 @@ package com.flimbis.qi.adapter; ...@@ -2,48 +2,132 @@ package com.flimbis.qi.adapter;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import com.flimbis.qi.R; import com.flimbis.qi.R;
import com.flimbis.qi.model.EventModel;
public class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.ViewHolder>{ import java.util.List;
public class HomeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private Context context; private Context context;
private final int AGENDA = 0; private List<EventModel> items;
private final int AGENDA = 0;//all
private final int COURSE = 1; private final int COURSE = 1;
private final int TODO_TASK = 2; private final int TODO_TASK = 2;
public HomeAdapter(Context context) { public HomeAdapter(Context context, List<EventModel> items) {
this.context = context; this.context = context;
this.items = items;
} }
@NonNull @NonNull
@Override @Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null; RecyclerView.ViewHolder viewHolder;
LayoutInflater inflater = LayoutInflater.from(context);
switch (viewType) {
case COURSE:
View course_view = inflater.inflate(R.layout.items_main, parent, false);
viewHolder = new ViewHolder(course_view);
break;
case TODO_TASK:
View todo_view = inflater.inflate(R.layout.items_main_todo, parent, false);
viewHolder = new TodoViewHolder(todo_view);
break;
default:
View def_view = inflater.inflate(R.layout.items_main, parent, false);
viewHolder = new ViewHolder(def_view);
break;
}
return viewHolder;
} }
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
switch (holder.getItemViewType()) {
case COURSE:
ViewHolder courseViewHolder = (ViewHolder) holder;
bindCourseViewHolder(courseViewHolder, position);
break;
case TODO_TASK:
TodoViewHolder todoViewHolder = (TodoViewHolder) holder;
bindTodoViewHolder(todoViewHolder, position);
break;
default:
break;
}
}
private void bindTodoViewHolder(TodoViewHolder todoViewHolder, int position) {
EventModel event = items.get(position);
todoViewHolder.type.setText("GROUP(mobserv)");
todoViewHolder.title.setText(event.getAlias());
todoViewHolder.desc.setText(event.getDescription());
}
private void bindCourseViewHolder(ViewHolder courseViewHolder, int position) {
EventModel event = items.get(position);
courseViewHolder.type.setText("CLASS"+"("+event.getVenue().get(0)+")");
courseViewHolder.title.setText(event.getAlias());
courseViewHolder.date.setText("starts~"+event.getStart());//start and end
} }
@Override @Override
public int getItemCount() { public int getItemCount() {
return 0; return items.size();
}
@Override
public int getItemViewType(int position) {
//class
if (items.get(position).getType()== 0) {
return COURSE;
} else {
return TODO_TASK;
}
} }
public class ViewHolder extends RecyclerView.ViewHolder{ public class ViewHolder extends RecyclerView.ViewHolder{
private TextView type;
private TextView title; private TextView title;
private TextView date; private TextView date;
private CardView card;
public ViewHolder(View itemView) { public ViewHolder(View itemView) {
super(itemView); super(itemView);
card = itemView.findViewById(R.id.card_main);
type = itemView.findViewById(R.id.txt_main_type);
title = itemView.findViewById(R.id.txt_main_title); title = itemView.findViewById(R.id.txt_main_title);
date = itemView.findViewById(R.id.txt_main_date); date = itemView.findViewById(R.id.txt_main_date);
} }
} }
public class TodoViewHolder extends RecyclerView.ViewHolder{
private TextView type;
private TextView title;
private TextView desc;
private CardView todoCard;
public TodoViewHolder(View itemView) {
super(itemView);
todoCard = itemView.findViewById(R.id.card_main_todo);
type = itemView.findViewById(R.id.txt_main_td_type);
title = itemView.findViewById(R.id.txt_main_td_title);
desc = itemView.findViewById(R.id.txt_main_td_desc);
}
}
} }
package com.flimbis.qi.di.component;
import com.flimbis.qi.MainActivity;
import com.flimbis.qi.di.module.ApiModule;
import com.flimbis.qi.di.module.AppModule;