Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Commit

Permalink
New Dashboard (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
leomaxi authored Jan 25, 2018
1 parent 191c51b commit f164e2f
Show file tree
Hide file tree
Showing 29 changed files with 932 additions and 19 deletions.
17 changes: 12 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "org.ole.learning.planet.planetlearning"
minSdkVersion 17
targetSdkVersion 25
versionCode 2
versionName "2.1.2"
versionName "2.1.3"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand All @@ -21,9 +21,14 @@ android {
}

packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
lintOptions {
abortOnError false
Expand All @@ -45,13 +50,14 @@ android {
compile 'com.github.kittinunf.fuel:fuel-android:1.3.1'
compile 'com.couchbase.lite:couchbase-lite-android:1.+'
compile 'org.lightcouch:lightcouch:0.1.8'
compile 'com.github.tonyofrancis:Fetch:+'
compile 'com.tonyodev.fetch:fetch:1.1.5'
compile 'us.feras.mdv:markdownview:1.1.0'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.github.tdscientist:ShelfView:v1.0'

compile 'com.github.florent37:diagonallayout:1.0.4'
compile 'org.webjars.npm:jsonparse:1.2.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
//compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.roughike:bottom-bar:1.3.3'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
Expand All @@ -66,6 +72,7 @@ android {
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.+'
}

Expand Down
24 changes: 18 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?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="org.ole.learning.planet.planetlearning">

<!-- To auto-complete the email text field in the login form with the user's emails -->
Expand Down Expand Up @@ -31,39 +32,50 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:supportsRtl="false"
android:theme="@style/AppTheme"
tools:replace="allowBackup,supportsRtl"
tools:ignore="GoogleAppIndexingWarning,UnusedAttribute">
<activity
android:name=".MainActivity"
android:screenOrientation="landscape"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<service
android:name=".ServerSearchService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

<activity
android:name=".FullscreenLogin"
android:configChanges="locale|orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_fullscreen_login"
android:screenOrientation="landscape"
android:theme="@style/AppTheme"></activity>
android:theme="@style/AppTheme" />
<activity
android:name=".User_Dashboard"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_user__dashboard"
android:screenOrientation="landscape"
android:theme="@style/FullscreenTheme"></activity>
android:theme="@style/FullscreenTheme" />
<activity
android:name=".DownloadingItems"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_downloading_items"
android:screenOrientation="landscape"
android:theme="@style/FullscreenTheme"></activity>
android:theme="@style/FullscreenTheme" />
<activity
android:name=".Main_Dashboard"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/title_activity_main__dashboard"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ public void onClick(View view) {
});
//

TextView Version = (TextView) findViewById(R.id.txtVersion);
Version.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//alertDialogOkay("This feature has not been activated on this version.");
//setLocale("fr");
Intent intent = new Intent(context, Main_Dashboard.class);
startActivity(intent);
}
});
//


// New UI
ImageButton SetupButton = (ImageButton) findViewById(R.id.btnSetup);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
package org.ole.learning.planet.planetlearning;

import android.app.ProgressDialog;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
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;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.LinearLayout;

import com.couchbase.lite.Database;
import com.couchbase.lite.Document;
import com.couchbase.lite.Manager;
import com.couchbase.lite.Query;
import com.couchbase.lite.QueryEnumerator;
import com.couchbase.lite.QueryRow;
import com.tdscientist.shelfview.BookModel;
import com.tdscientist.shelfview.ShelfView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;

import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;


public class Main_Dashboard extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_dashboard);
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();

NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);


}
/*
public void LoadShelfResourceList() {
String memberId = sys_usercouchId;
try {
manager = new Manager(androidContext, Manager.DEFAULT_OPTIONS);
Database db = manager.getExistingDatabase("shelf");
Database resource_Db = manager.getDatabase("resources");
Query orderedQuery = chViews.ReadShelfByIdView(db).createQuery();
orderedQuery.setDescending(true);
QueryEnumerator results = orderedQuery.run();
resourceIdList = new String[results.getCount()];
resourceTitleList= new String[results.getCount()];
rsLstCnt = 0;
for (Iterator<QueryRow> it = results; it.hasNext(); ) {
QueryRow row = it.next();
String docId = (String) row.getValue();
Document doc = db.getExistingDocument(docId);
Map<String, Object> properties = doc.getProperties();
Map<String, Object> resource_properties = null;
if(memberId.equals((String) properties.get("memberId"))) {
String myresTitile = ((String) properties.get("resourceTitle"));
String myresId = ((String) properties.get("resourceId"));
String myresType,myresDec,myresExt = "";
resourceTitleList[rsLstCnt]=myresTitile;
resourceIdList[rsLstCnt]=myresId;
resIDArrayList.add(myresId);
Log.e("tag", "MEMBER ID "+ (String) properties.get("resourceTitle"));
try {
Document resource_doc = resource_Db.getExistingDocument((String) properties.get("resourceId"));
Log.e("tag", "RES ID "+ (String) properties.get("resourceId"));
try {
resource_properties = resource_doc.getProperties();
}catch(Exception errs){
Log.e("tag", "OBJECT ERROR "+ errs.toString());
}
//myresTitile = (String) resource_properties.get("title")+"";
//myresId = (String) properties.get("resourceId")+"";
myresDec = (String) resource_properties.get("author")+"";
myresType = (String) resource_properties.get("averageRating")+"";
myresExt = (String) resource_properties.get("openWith")+"";
rsLstCnt++;
}catch(Exception err){
Log.e("tag", "ERROR "+ err.getMessage());
//myresTitile = "Unknown resource .. ";
//myresId = "";
myresDec = "";
myresType = "";
rsLstCnt++;
}
Resource resource = new Resource();
resource.setTitle(myresTitile);
resource.setThumbnailUrl(getIconType(myresExt));
resource.setDescription(myresDec);
resource.setRating(myresType);
resource.setGenre(null);
// adding resource to resources array
resourceList.add(resource);
resourceNo++;
}
}
LinearLayout row2 = (LinearLayout) findViewById(R.id.layholder_library);
libraryButtons = new Button[rsLstCnt];
for( int ButtonCnt=0;ButtonCnt< rsLstCnt;ButtonCnt++) {
libraryButtons[ButtonCnt] = new Button(this);
libraryButtons[ButtonCnt].setText(resourceTitleList[ButtonCnt]);
libraryButtons[ButtonCnt].setId(ButtonCnt);
libraryButtons[ButtonCnt].setBackgroundResource(R.drawable.rounded_corners_black_blue);
libraryButtons[ButtonCnt].setTextColor(getResources().getColor(R.color.white));
libraryButtons[ButtonCnt].setAllCaps(false);
libraryButtons[ButtonCnt].setPadding(10, 5, 10, 5);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
libraryButtons[ButtonCnt].setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
}
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(170,MATCH_PARENT);
layoutParams.setMargins(1, 0, 1, 0); // left, top, right, bottom
GradientDrawable drawable = new GradientDrawable();
drawable.setShape(GradientDrawable.RECTANGLE);
drawable.setStroke(2, Color.WHITE);
drawable.setCornerRadius(2);
drawable.setColor(getResources().getColor(R.color.ole_black_blue));
libraryButtons[ButtonCnt].setBackgroundDrawable(drawable);
libraryButtons[ButtonCnt].setLayoutParams(layoutParams);
row2.addView(libraryButtons[ButtonCnt]);
try {
manager = new Manager(androidContext, Manager.DEFAULT_OPTIONS);
Document resource_doc = resource_Db.getExistingDocument((String) resourceIdList[ButtonCnt]);
Map<String, Object> resource_properties = resource_doc.getProperties();
Log.e("tag", "RES ID " + (String) resource_properties.get("resourceId"));
libraryButtons[ButtonCnt].setTextColor(getResources().getColor(R.color.ole_white));
}catch(Exception errs){
libraryButtons[ButtonCnt].setTextColor(getResources().getColor(R.color.ole_yellow));
Log.e("tag", "OBJECT ERROR "+ errs.toString());
}
libraryButtons[ButtonCnt].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(libraryButtons[view.getId()].getCurrentTextColor()==getResources().getColor(R.color.ole_yellow)){
MaterialClickDialog(false,resourceTitleList[view.getId()],resourceIdList[view.getId()],view.getId());
}else{
mDialog = new ProgressDialog(context);
mDialog.setMessage("Opening please "+resourceTitleList[view.getId()]+" wait...");
mDialog.setCancelable(true);
mDialog.show();
openedResourceId=resourceIdList[view.getId()];
openedResourceTitle = resourceTitleList[view.getId()];
openedResource =true;
openDoc(resourceIdList[view.getId()]);
Log.e("MyCouch", "Clicked to open "+ resourceIdList[view.getId()]);
}
}
});
//////////// Save list in Preferences
}
db.close();
} catch (Exception e) {
e.printStackTrace();
}
}
*/

@Override
public void onBackPressed() {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main__dashboard, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();

if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {

} else if (id == R.id.nav_slideshow) {

} else if (id == R.id.nav_manage) {

}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
Loading

0 comments on commit f164e2f

Please sign in to comment.