Initial Commit
This commit is contained in:
parent
21ea644abc
commit
7e00e89327
4
.idea/gradle.xml
generated
4
.idea/gradle.xml
generated
@ -8,6 +8,10 @@
|
|||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/SalesforceAnalytics" />
|
||||||
|
<option value="$PROJECT_DIR$/SalesforceSDK" />
|
||||||
|
<option value="$PROJECT_DIR$/SmartStore" />
|
||||||
|
<option value="$PROJECT_DIR$/SmartSync" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
<option value="$PROJECT_DIR$/epublib-core-latest" />
|
<option value="$PROJECT_DIR$/epublib-core-latest" />
|
||||||
</set>
|
</set>
|
||||||
|
|||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -37,7 +37,7 @@
|
|||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" 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">
|
||||||
|
|||||||
4
.idea/modules.xml
generated
4
.idea/modules.xml
generated
@ -3,6 +3,10 @@
|
|||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/EnhancedUrduReader.iml" filepath="$PROJECT_DIR$/EnhancedUrduReader.iml" />
|
<module fileurl="file://$PROJECT_DIR$/EnhancedUrduReader.iml" filepath="$PROJECT_DIR$/EnhancedUrduReader.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/SalesforceAnalytics/SalesforceAnalytics.iml" filepath="$PROJECT_DIR$/SalesforceAnalytics/SalesforceAnalytics.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/SalesforceSDK/SalesforceSDK.iml" filepath="$PROJECT_DIR$/SalesforceSDK/SalesforceSDK.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/SmartStore/SmartStore.iml" filepath="$PROJECT_DIR$/SmartStore/SmartStore.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/SmartSync/SmartSync.iml" filepath="$PROJECT_DIR$/SmartSync/SmartSync.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/epublib-core-latest/epublib-core-latest.iml" filepath="$PROJECT_DIR$/epublib-core-latest/epublib-core-latest.iml" />
|
<module fileurl="file://$PROJECT_DIR$/epublib-core-latest/epublib-core-latest.iml" filepath="$PROJECT_DIR$/epublib-core-latest/epublib-core-latest.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
|
|||||||
BIN
SalesforceAnalytics/SalesforceAnalytics-release.aar
Normal file
BIN
SalesforceAnalytics/SalesforceAnalytics-release.aar
Normal file
Binary file not shown.
2
SalesforceAnalytics/build.gradle
Normal file
2
SalesforceAnalytics/build.gradle
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('SalesforceAnalytics-release.aar'))
|
||||||
BIN
SalesforceSDK/SalesforceSDK-release.aar
Normal file
BIN
SalesforceSDK/SalesforceSDK-release.aar
Normal file
Binary file not shown.
4
SalesforceSDK/build.gradle
Normal file
4
SalesforceSDK/build.gradle
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('SalesforceSDK-release.aar'))
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
BIN
SmartStore/SmartStore-release.aar
Normal file
BIN
SmartStore/SmartStore-release.aar
Normal file
Binary file not shown.
2
SmartStore/build.gradle
Normal file
2
SmartStore/build.gradle
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('SmartStore-release.aar'))
|
||||||
BIN
SmartSync/SmartSync-release.aar
Normal file
BIN
SmartSync/SmartSync-release.aar
Normal file
Binary file not shown.
4
SmartSync/build.gradle
Normal file
4
SmartSync/build.gradle
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('SmartSync-release.aar'))
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ android {
|
|||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
//multiDexEnabled = true
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@ -32,4 +33,9 @@ dependencies {
|
|||||||
compile 'com.squareup.picasso:picasso:2.5.2'
|
compile 'com.squareup.picasso:picasso:2.5.2'
|
||||||
compile files('libs/epublib-core-latest.jar')
|
compile files('libs/epublib-core-latest.jar')
|
||||||
compile files('libs/slf4j-android-1.6.1-RC1.jar')
|
compile files('libs/slf4j-android-1.6.1-RC1.jar')
|
||||||
|
compile project(':SmartSync')
|
||||||
|
compile project(':SalesforceAnalytics')
|
||||||
|
compile project(':SalesforceSDK')
|
||||||
|
compile project(':SmartStore')
|
||||||
|
compile 'com.squareup.okhttp3:okhttp:3.8.0'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:name=".MainApplication"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activities.MainActivity"
|
android:name=".Activities.MainActivity"
|
||||||
@ -28,6 +29,8 @@
|
|||||||
<activity android:name=".Activities.ArticlePublishActivity" />
|
<activity android:name=".Activities.ArticlePublishActivity" />
|
||||||
<activity android:name=".Activities.SegmentedBookReaderActivity" />
|
<activity android:name=".Activities.SegmentedBookReaderActivity" />
|
||||||
<activity android:name=".Activities.EpubReaderActivity"></activity>
|
<activity android:name=".Activities.EpubReaderActivity"></activity>
|
||||||
|
<activity android:name=".Activities.SalesforceDownloadActivity"></activity>
|
||||||
|
<activity android:name=".Activities.SalesforceUploadActivity"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -3,14 +3,15 @@ package com.example.manan.enhancedurdureader.Activities;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.design.widget.FloatingActionButton;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.method.ScrollingMovementMethod;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.ScaleGestureDetector;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.webkit.WebView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@ -25,7 +26,7 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Integer articleId;
|
Integer articleId;
|
||||||
NastaleeqTextView title;
|
NastaleeqTextView title;
|
||||||
NastaleeqTextView body;
|
WebView body;
|
||||||
LocalStorage db;
|
LocalStorage db;
|
||||||
Article article;
|
Article article;
|
||||||
ImageView upvotes;
|
ImageView upvotes;
|
||||||
@ -34,12 +35,25 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
TextView totalDownvotes;
|
TextView totalDownvotes;
|
||||||
Intent articleIntent;
|
Intent articleIntent;
|
||||||
|
|
||||||
Integer currentUpvotes;
|
Integer currentUpvotes =0;
|
||||||
Integer currentDownvotes;
|
Integer currentDownvotes =0;
|
||||||
|
|
||||||
SharedPreferences userProfileStorage;
|
SharedPreferences userProfileStorage;
|
||||||
public static final String USER_PROFILE_STORAGE = "UserProfileStorage" ;
|
public static final String USER_PROFILE_STORAGE = "UserProfileStorage" ;
|
||||||
|
|
||||||
|
protected float swipeOriginX, swipeOriginY;
|
||||||
|
private ScaleGestureDetector mScaleDetector;
|
||||||
|
|
||||||
|
float oldDist = 1f;
|
||||||
|
static final int NONE = 0;
|
||||||
|
static final int ZOOM = 1;
|
||||||
|
int mode = NONE;
|
||||||
|
boolean swipeFlag = true;
|
||||||
|
static int textSize = 120;
|
||||||
|
|
||||||
|
private float x1, x2;
|
||||||
|
static final int MIN_DISTANCE = 150;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
@ -53,7 +67,7 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
updateValues();
|
updateValues();
|
||||||
|
|
||||||
upvotes = (ImageView)findViewById(R.id.upvote);
|
/*upvotes = (ImageView)findViewById(R.id.upvote);
|
||||||
totalUpvotes = (TextView) findViewById(R.id.total_upvotes);
|
totalUpvotes = (TextView) findViewById(R.id.total_upvotes);
|
||||||
currentUpvotes = db.getAllUpvotes(article.get_id(), article.getMagzineId());
|
currentUpvotes = db.getAllUpvotes(article.get_id(), article.getMagzineId());
|
||||||
totalUpvotes.setText(currentUpvotes.toString());
|
totalUpvotes.setText(currentUpvotes.toString());
|
||||||
@ -90,9 +104,9 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
totalDownvotes = (TextView) findViewById(R.id.total_downvotes);
|
totalDownvotes = (TextView) findViewById(R.id.total_downvotes);
|
||||||
|
|
||||||
currentDownvotes = db.getAllDownvotes(article.get_id(), article.getMagzineId());
|
currentDownvotes = db.getAllDownvotes(article.get_id(), article.getMagzineId());
|
||||||
totalDownvotes.setText(currentDownvotes.toString());
|
totalDownvotes.setText(currentDownvotes.toString());*/
|
||||||
|
|
||||||
downvotes.setOnClickListener(new View.OnClickListener() {
|
/* downvotes.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
|
||||||
@ -120,10 +134,10 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.publish_article);
|
/* FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.publish_article);
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
@ -131,7 +145,7 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
publishIntent.putExtra("articleId", articleId);
|
publishIntent.putExtra("articleId", articleId);
|
||||||
startActivity(publishIntent);
|
startActivity(publishIntent);
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -144,15 +158,83 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
private void updateValues(){
|
private void updateValues(){
|
||||||
|
|
||||||
title = (NastaleeqTextView) findViewById(R.id.article_read_act_title);
|
title = (NastaleeqTextView) findViewById(R.id.article_read_act_title);
|
||||||
body = (NastaleeqTextView) findViewById(R.id.article_read_act_body);
|
body = (WebView) findViewById(R.id.article_read_act_body);
|
||||||
|
|
||||||
db = new LocalStorage(this, null, null, 1);
|
db = new LocalStorage(this, null, null, 1);
|
||||||
article = db.getArticle(articleId);
|
article = db.getArticle(articleId);
|
||||||
|
|
||||||
title.setText(article.getArticleTitle());
|
title.setText(article.getArticleTitle());
|
||||||
body.setText(article.getArticleBody());
|
//body.set(article.getArticleBody());
|
||||||
|
body.getSettings().setJavaScriptEnabled(true);
|
||||||
|
body.loadDataWithBaseURL("", article.getArticleBody(), "text/html", "UTF-8", "");
|
||||||
|
//body.getSettings().setBuiltInZoomControls(true);
|
||||||
|
|
||||||
body.setMovementMethod(new ScrollingMovementMethod());
|
body.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
|
||||||
|
/* if (state == ViewStateEnum.books)
|
||||||
|
swipePage(v, event, 0);
|
||||||
|
//int fontSize, newFont;*/
|
||||||
|
WebView view = (WebView) v;
|
||||||
|
|
||||||
|
switch (event.getAction() & MotionEvent.ACTION_MASK) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
x1 = event.getX();
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
if(mode != ZOOM && swipeFlag) {
|
||||||
|
//if (state == ViewStateEnum.books)
|
||||||
|
//swipePage(v, event, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
|
oldDist = spacing(event);
|
||||||
|
if (oldDist > 10f) {
|
||||||
|
mode = ZOOM;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
|
mode = NONE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
|
||||||
|
if(mode == ZOOM) {
|
||||||
|
float newDist = spacing(event);
|
||||||
|
if (newDist > 10f) {
|
||||||
|
float scale = newDist / oldDist;
|
||||||
|
if (scale > 1) {
|
||||||
|
int currentTextSize = view.getSettings().getTextZoom();
|
||||||
|
textSize = currentTextSize + 15;
|
||||||
|
view.getSettings().setTextZoom(textSize);
|
||||||
|
|
||||||
|
mode = NONE;
|
||||||
|
swipeFlag = false;
|
||||||
|
} else {
|
||||||
|
int currentTextSize = view.getSettings().getTextZoom();
|
||||||
|
textSize = currentTextSize - 15;
|
||||||
|
view.getSettings().setTextZoom(textSize);
|
||||||
|
mode = NONE;
|
||||||
|
swipeFlag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
return view.onTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//body.setMovementMethod(new ScrollingMovementMethod());
|
||||||
|
}
|
||||||
|
private float spacing(MotionEvent event) {
|
||||||
|
float x = event.getX(0) - event.getX(1);
|
||||||
|
float y = event.getY(0) - event.getY(1);
|
||||||
|
return (int) Math.sqrt(x * x + y * y);
|
||||||
}
|
}
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@ -173,6 +255,79 @@ public class ArticleReadingActivity extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_upload_article) {
|
||||||
|
|
||||||
|
/* Intent publishIntent = new Intent(ArticleReadingActivity.this, ArticlePublishActivity.class);
|
||||||
|
publishIntent.putExtra("articleId", articleId);
|
||||||
|
startActivity(publishIntent);*/
|
||||||
|
|
||||||
|
Intent uploadIntent = new Intent(ArticleReadingActivity.this, SalesforceUploadActivity.class);
|
||||||
|
uploadIntent.putExtra("id", articleId);
|
||||||
|
uploadIntent.putExtra("name", article.getArticleTitle());
|
||||||
|
uploadIntent.putExtra("body", article.getArticleBody());
|
||||||
|
|
||||||
|
startActivity(uploadIntent);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == R.id.action_upvote) {
|
||||||
|
|
||||||
|
ArticleVote vote = new ArticleVote();
|
||||||
|
vote.setArticle(articleId);
|
||||||
|
vote.setMagzine(article.getMagzineId());
|
||||||
|
vote.setValue(1);
|
||||||
|
vote.setUser(userProfileStorage.getInt("userId", -1));
|
||||||
|
|
||||||
|
if(db.alreadyCastedVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), 1)) {
|
||||||
|
Toast.makeText(getApplicationContext(), "Already Upvoted!", Toast.LENGTH_SHORT ).show();
|
||||||
|
} else {
|
||||||
|
if(db.alreadyCastedVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), -1)) {
|
||||||
|
db.deleteVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), -1);
|
||||||
|
currentDownvotes --;
|
||||||
|
//totalDownvotes.setText(currentDownvotes.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
db.insertVote(vote);
|
||||||
|
//currentUpvotes = Integer.valueOf(totalUpvotes.getText().toString());
|
||||||
|
currentUpvotes ++;
|
||||||
|
//totalUpvotes.setText(currentUpvotes.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (id == R.id.action_downvote) {
|
||||||
|
|
||||||
|
ArticleVote vote = new ArticleVote();
|
||||||
|
vote.setArticle(articleId);
|
||||||
|
vote.setMagzine(article.getMagzineId());
|
||||||
|
vote.setValue(-1);
|
||||||
|
vote.setUser(userProfileStorage.getInt("userId", -1));
|
||||||
|
|
||||||
|
if(db.alreadyCastedVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), -1)) {
|
||||||
|
Toast.makeText(getApplicationContext(), "Already Downvoted!", Toast.LENGTH_SHORT ).show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(db.alreadyCastedVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), 1)) {
|
||||||
|
db.deleteVote(vote.getUser(), vote.getArticle(), vote.getMagzine(), 1);
|
||||||
|
currentUpvotes --;
|
||||||
|
//totalUpvotes.setText(currentUpvotes.toString());
|
||||||
|
}
|
||||||
|
db.insertVote(vote);
|
||||||
|
//currentDownvotes = Integer.valueOf(totalDownvotes.getText().toString());
|
||||||
|
currentDownvotes++;
|
||||||
|
//totalDownvotes.setText(currentDownvotes.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,9 @@ package com.example.manan.enhancedurdureader.Activities;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.view.View;
|
|
||||||
import android.support.design.widget.NavigationView;
|
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
@ -14,21 +13,24 @@ import android.support.v7.app.AppCompatActivity;
|
|||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import com.example.manan.enhancedurdureader.Adapters.PagerAdapter;
|
import com.example.manan.enhancedurdureader.Adapters.PagerAdapter;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
|
||||||
import com.example.manan.enhancedurdureader.CustomViews.CustomViewPager;
|
import com.example.manan.enhancedurdureader.CustomViews.CustomViewPager;
|
||||||
import com.example.manan.enhancedurdureader.Fragments.MagazinesFragment;
|
import com.example.manan.enhancedurdureader.Fragments.MagazinesFragment;
|
||||||
import com.example.manan.enhancedurdureader.R;
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
import com.salesforce.androidsdk.rest.RestClient;
|
||||||
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity
|
public class MainActivity extends AppCompatActivity
|
||||||
implements NavigationView.OnNavigationItemSelectedListener {
|
implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
|
SalesforceDownloadActivity sfActivity = new SalesforceDownloadActivity();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -40,7 +42,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
Snackbar.make(view, "Loading Articles", Snackbar.LENGTH_LONG)
|
||||||
.setAction("Action", null).show();
|
.setAction("Action", null).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -91,6 +93,12 @@ public class MainActivity extends AppCompatActivity
|
|||||||
startActivity(newArticle);
|
startActivity(newArticle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (id == R.id.action_refresh) {
|
||||||
|
|
||||||
|
Intent refreshFromSalesforce = new Intent(this, SalesforceDownloadActivity.class);
|
||||||
|
startActivity(refreshFromSalesforce);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@ -156,4 +164,10 @@ public class MainActivity extends AppCompatActivity
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RestClient client;
|
||||||
|
|
||||||
|
|
||||||
|
//public static ArrayAdapter<String> listAdapter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,164 @@
|
|||||||
|
package com.example.manan.enhancedurdureader.Activities;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
||||||
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
||||||
|
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
||||||
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
import com.salesforce.androidsdk.app.SalesforceSDKManager;
|
||||||
|
import com.salesforce.androidsdk.rest.ApiVersionStrings;
|
||||||
|
import com.salesforce.androidsdk.rest.RestClient;
|
||||||
|
import com.salesforce.androidsdk.rest.RestRequest;
|
||||||
|
import com.salesforce.androidsdk.rest.RestResponse;
|
||||||
|
import com.salesforce.androidsdk.ui.SalesforceActivity;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by anas on 5/28/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SalesforceDownloadActivity extends SalesforceActivity {
|
||||||
|
|
||||||
|
RestClient client;
|
||||||
|
ArrayList<String> MagazineList;
|
||||||
|
LocalStorage db;
|
||||||
|
|
||||||
|
public SalesforceDownloadActivity(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||||
|
super.onCreate(savedInstanceState, persistentState);
|
||||||
|
setContentView(R.layout.salesforce_layout);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Salesforce Activity", Toast.LENGTH_LONG).show();
|
||||||
|
// db = new LocalStorage(this, null, null, 1);
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(RestClient client) {
|
||||||
|
// Keeping reference to rest client
|
||||||
|
this.client = client;
|
||||||
|
try {
|
||||||
|
//getMagazines("Select Name From Magazine__c");
|
||||||
|
getArticles("Select Name, Body__c From Articles__c");
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show everything
|
||||||
|
//findViewById(R.id.drawer_layout).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getMagazines(String soql) throws UnsupportedEncodingException {
|
||||||
|
|
||||||
|
RestRequest restRequest = RestRequest.getRequestForQuery(ApiVersionStrings.getVersionNumber(this), soql);
|
||||||
|
|
||||||
|
client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RestRequest request, final RestResponse result) {
|
||||||
|
result.consumeQuietly(); // consume before going back to main thread
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
JSONArray records = result.asJSONObject().getJSONArray("records");
|
||||||
|
for (int i = 0; i < records.length(); i++) {
|
||||||
|
//MagazineList.add(records.getJSONObject(i).getString("Name"));
|
||||||
|
|
||||||
|
Magazine newMagazine = new Magazine();
|
||||||
|
newMagazine.setTitleResId(records.getJSONObject(i).getString("Name"));
|
||||||
|
db = new LocalStorage(getApplicationContext(), null, null, 1);
|
||||||
|
db.insertMagzine(newMagazine);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(final Exception exception) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Toast.makeText(SalesforceDownloadActivity.this,
|
||||||
|
SalesforceDownloadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError(), exception.toString()),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getArticles(String soql) throws UnsupportedEncodingException {
|
||||||
|
|
||||||
|
RestRequest restRequest = RestRequest.getRequestForQuery(ApiVersionStrings.getVersionNumber(this), soql);
|
||||||
|
|
||||||
|
client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RestRequest request, final RestResponse result) {
|
||||||
|
result.consumeQuietly(); // consume before going back to main thread
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
JSONArray records = result.asJSONObject().getJSONArray("records");
|
||||||
|
db = new LocalStorage(getApplicationContext(), null, null, 1);
|
||||||
|
for (int i = 0; i < records.length(); i++) {
|
||||||
|
//MagazineList.add(records.getJSONObject(i).getString("Name"));
|
||||||
|
boolean dbCheck = db.checkArticle(records.getJSONObject(i).getString("Name"));
|
||||||
|
if(dbCheck == false) {
|
||||||
|
Article newArticle = new Article();
|
||||||
|
newArticle.setArticleTitle(records.getJSONObject(i).getString("Name"));
|
||||||
|
newArticle.setArticleBody(records.getJSONObject(i).getString("Body__c"));
|
||||||
|
|
||||||
|
db.insertArticle(newArticle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finish();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(final Exception exception) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Toast.makeText(SalesforceDownloadActivity.this,
|
||||||
|
SalesforceDownloadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError(), exception.toString()),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
System.out.println(SalesforceDownloadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,187 @@
|
|||||||
|
package com.example.manan.enhancedurdureader.Activities;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
||||||
|
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
||||||
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
import com.salesforce.androidsdk.app.SalesforceSDKManager;
|
||||||
|
import com.salesforce.androidsdk.rest.ApiVersionStrings;
|
||||||
|
import com.salesforce.androidsdk.rest.RestClient;
|
||||||
|
import com.salesforce.androidsdk.rest.RestRequest;
|
||||||
|
import com.salesforce.androidsdk.rest.RestResponse;
|
||||||
|
import com.salesforce.androidsdk.ui.SalesforceActivity;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by anas on 5/28/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class SalesforceUploadActivity extends SalesforceActivity {
|
||||||
|
|
||||||
|
RestClient client;
|
||||||
|
ArrayList<String> MagazineList;
|
||||||
|
LocalStorage db;
|
||||||
|
|
||||||
|
Article article = new Article();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||||
|
super.onCreate(savedInstanceState, persistentState);
|
||||||
|
setContentView(R.layout.salesforce_layout);
|
||||||
|
|
||||||
|
Toast.makeText(this, "Salesforce Activity", Toast.LENGTH_LONG).show();
|
||||||
|
Intent in = getIntent();
|
||||||
|
article.set_id(in.getIntExtra("id", 1));
|
||||||
|
article.setArticleTitle(in.getStringExtra("name"));
|
||||||
|
article.setArticleBody(in.getStringExtra("body"));
|
||||||
|
// article.set_id(in.getIntExtra("id", 1));
|
||||||
|
// db = new LocalStorage(this, null, null, 1);
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(RestClient client) {
|
||||||
|
// Keeping reference to rest client
|
||||||
|
this.client = client;
|
||||||
|
try {
|
||||||
|
|
||||||
|
Intent in = getIntent();
|
||||||
|
article.set_id(in.getIntExtra("id", 1));
|
||||||
|
article.setArticleTitle(in.getStringExtra("name"));
|
||||||
|
article.setArticleBody(in.getStringExtra("body"));
|
||||||
|
|
||||||
|
sendRequest(article);
|
||||||
|
//getArticles("Select Name, Body__c, Magazine__c From Articles__c");
|
||||||
|
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show everything
|
||||||
|
//findViewById(R.id.drawer_layout).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendRequest(Article article) throws UnsupportedEncodingException {
|
||||||
|
|
||||||
|
Map<String,Object> fields = new HashMap<String,Object>();
|
||||||
|
fields.put("Name", article.getArticleTitle());
|
||||||
|
fields.put("Body__c", article.getArticleBody());
|
||||||
|
|
||||||
|
RestRequest restRequest = null;
|
||||||
|
try {
|
||||||
|
restRequest = RestRequest.getRequestForUpsert(ApiVersionStrings.getVersionNumber(this), "Articles__c", "App_Id__c", String.valueOf(article.get_id()), fields);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RestRequest request, final RestResponse result) {
|
||||||
|
try {
|
||||||
|
Log.d("Result from Upload", result.asString().toString());// consume before going back to main thread
|
||||||
|
finish();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.v("Exception", e.getMessage());
|
||||||
|
}
|
||||||
|
/* runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
JSONArray records = result.asJSONObject().getJSONArray("records");
|
||||||
|
for (int i = 0; i < records.length(); i++) {
|
||||||
|
//MagazineList.add(records.getJSONObject(i).getString("Name"));
|
||||||
|
|
||||||
|
Magazine newMagazine = new Magazine();
|
||||||
|
newMagazine.setTitleResId(records.getJSONObject(i).getString("Name"));
|
||||||
|
db = new LocalStorage(getApplicationContext(), null, null, 1);
|
||||||
|
db.insertMagzine(newMagazine);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(final Exception exception) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Toast.makeText(SalesforceUploadActivity.this,
|
||||||
|
SalesforceUploadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError(), exception.toString()),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getArticles(String soql) throws UnsupportedEncodingException {
|
||||||
|
|
||||||
|
RestRequest restRequest = RestRequest.getRequestForQuery(ApiVersionStrings.getVersionNumber(this), soql);
|
||||||
|
|
||||||
|
client.sendAsync(restRequest, new RestClient.AsyncRequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(RestRequest request, final RestResponse result) {
|
||||||
|
result.consumeQuietly(); // consume before going back to main thread
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
//MagazineList = new ArrayList<String>();
|
||||||
|
JSONArray records = result.asJSONObject().getJSONArray("records");
|
||||||
|
for (int i = 0; i < records.length(); i++) {
|
||||||
|
//MagazineList.add(records.getJSONObject(i).getString("Name"));
|
||||||
|
|
||||||
|
Article newArticle = new Article();
|
||||||
|
newArticle.setArticleTitle(records.getJSONObject(i).getString("Name"));
|
||||||
|
newArticle.setArticleBody(records.getJSONObject(i).getString("Body__c"));
|
||||||
|
db = new LocalStorage(getApplicationContext(), null, null, 1);
|
||||||
|
db.insertArticle(newArticle);
|
||||||
|
}
|
||||||
|
|
||||||
|
finish();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
onError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(final Exception exception) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Toast.makeText(SalesforceUploadActivity.this,
|
||||||
|
SalesforceUploadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError(), exception.toString()),
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
System.out.println(SalesforceUploadActivity.this.getString(SalesforceSDKManager.getInstance().getSalesforceR().stringGenericError()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,46 +5,24 @@ import android.content.Intent;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.ViewTreeObserver;
|
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.bumptech.glide.GenericRequestBuilder;
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.bumptech.glide.load.ResourceDecoder;
|
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
|
||||||
import com.bumptech.glide.load.engine.Resource;
|
|
||||||
import com.bumptech.glide.load.model.StreamEncoder;
|
|
||||||
import com.bumptech.glide.load.model.stream.StreamUriLoader;
|
|
||||||
import com.bumptech.glide.load.resource.SimpleResource;
|
|
||||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation;
|
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
|
||||||
import com.bumptech.glide.request.target.SizeReadyCallback;
|
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.BookInfo;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.BookInfo;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.PageInfo;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.PageInfo;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.PageOffset;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.PageOffset;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.SegmentedBook;
|
|
||||||
import com.example.manan.enhancedurdureader.R;
|
import com.example.manan.enhancedurdureader.R;
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class SegmentedBookReaderActivity extends AppCompatActivity {
|
public class SegmentedBookReaderActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@ -139,7 +117,7 @@ public class SegmentedBookReaderActivity extends AppCompatActivity {
|
|||||||
iView.setId(View.generateViewId());
|
iView.setId(View.generateViewId());
|
||||||
iView.setBackground(new BitmapDrawable(getResources(), image));
|
iView.setBackground(new BitmapDrawable(getResources(), image));
|
||||||
|
|
||||||
totalLineWidth += image.getWidth();
|
totalLineWidth += image.getWidth()/3;//div by num
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(image.getWidth(), image.getHeight());
|
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(image.getWidth(), image.getHeight());
|
||||||
|
|
||||||
if (pageInfo.lastRenderedLigature == null) {
|
if (pageInfo.lastRenderedLigature == null) {
|
||||||
@ -150,7 +128,7 @@ public class SegmentedBookReaderActivity extends AppCompatActivity {
|
|||||||
} else if (totalLineWidth >= pageInfo.pageWidth) {
|
} else if (totalLineWidth >= pageInfo.pageWidth) {
|
||||||
params.addRule(RelativeLayout.BELOW, pageInfo.previousLineFirstRenderedLigature.getId());
|
params.addRule(RelativeLayout.BELOW, pageInfo.previousLineFirstRenderedLigature.getId());
|
||||||
params.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE);
|
params.addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE);
|
||||||
int maxHeight = getMaxHeightLigature(i);
|
int maxHeight = getMaxHeightLigature(i)/7;//div by num
|
||||||
if (maxHeight > bookInfo.margin) {
|
if (maxHeight > bookInfo.margin) {
|
||||||
//params.setMargins(0,bookInfo.margin+(maxHeight - bookInfo.margin - iView.getHeight()),0,0);
|
//params.setMargins(0,bookInfo.margin+(maxHeight - bookInfo.margin - iView.getHeight()),0,0);
|
||||||
params.setMargins(0, bookInfo.margin + maxHeight, 0, 0);
|
params.setMargins(0, bookInfo.margin + maxHeight, 0, 0);
|
||||||
@ -171,6 +149,7 @@ public class SegmentedBookReaderActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if((i+1) >= ((bookInfo.maxLinesInPage+1) * bookInfo.maxLigaturesInLine)) {
|
//if((i+1) >= ((bookInfo.maxLinesInPage+1) * bookInfo.maxLigaturesInLine)) {
|
||||||
|
//
|
||||||
if (totalPageHeight >= pageInfo.pageHeight) {
|
if (totalPageHeight >= pageInfo.pageHeight) {
|
||||||
pageOffset.endingLigatureIndex = j - 1;
|
pageOffset.endingLigatureIndex = j - 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
||||||
@ -81,10 +80,12 @@ public class ArticlePublishAdapter extends BaseAdapter {
|
|||||||
magazineTitlePage.setImageResource(R.drawable.all_articles_magazine);
|
magazineTitlePage.setImageResource(R.drawable.all_articles_magazine);
|
||||||
else if(image == null && magazineID ==1 )
|
else if(image == null && magazineID ==1 )
|
||||||
magazineTitlePage.setImageResource(R.drawable.saved_articles_magazine);
|
magazineTitlePage.setImageResource(R.drawable.saved_articles_magazine);
|
||||||
else {
|
else if(image != null) {
|
||||||
magazineTitlePage.setImageBitmap(image);
|
magazineTitlePage.setImageBitmap(image);
|
||||||
imageCache.put(position,image);
|
imageCache.put(position,image);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
magazineTitlePage.setImageResource(R.drawable.saved_articles_magazine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,6 @@ package com.example.manan.enhancedurdureader.Adapters;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.media.Image;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -17,13 +15,9 @@ import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
|||||||
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
||||||
import com.example.manan.enhancedurdureader.R;
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
|
||||||
import org.w3c.dom.Text;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by manan on 3/9/17.
|
* Created by manan on 3/9/17.
|
||||||
@ -99,8 +93,12 @@ public class MagazineAdapter extends BaseAdapter {
|
|||||||
Glide.with(mContext).load(R.drawable.all_articles_magazine).into(magazineTitlePage);
|
Glide.with(mContext).load(R.drawable.all_articles_magazine).into(magazineTitlePage);
|
||||||
else if(magazineID ==1 )
|
else if(magazineID ==1 )
|
||||||
Glide.with(mContext).load(R.drawable.saved_articles_magazine).into(magazineTitlePage);
|
Glide.with(mContext).load(R.drawable.saved_articles_magazine).into(magazineTitlePage);
|
||||||
else {
|
else if(mData.get(position%mData.size()).getImageResId() != null) {
|
||||||
Glide.with(mContext).load(new File(mData.get(position%mData.size()).getImageResId())).skipMemoryCache(false).into(magazineTitlePage);
|
Glide.with(mContext).load(new File(mData.get(position%mData.size()).getImageResId())).skipMemoryCache(false).into(magazineTitlePage);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Glide.with(mContext).load(R.drawable.saved_articles_magazine).into(magazineTitlePage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,17 +236,24 @@ public class LocalStorage extends SQLiteOpenHelper {
|
|||||||
//c.put(MAGZINE_COLUMN_EDITOR_ID, magzine.getEditorId());
|
//c.put(MAGZINE_COLUMN_EDITOR_ID, magzine.getEditorId());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
|
|
||||||
try{
|
// int nRowsEffected = db.update(DATABASE_NAME, c, "name = '"+magzine.getTitleResId()+"'", null);
|
||||||
|
|
||||||
|
// if(nRowsEffected <= 0) {
|
||||||
|
try{
|
||||||
|
|
||||||
|
Log.w("name", MAGZINE_COLUMN_NAME);
|
||||||
|
Log.w("cover", MAGZINE_COLUMN_COVER_PATH);
|
||||||
|
db.insert(DATABASE_TABLE_MAGZINES, null,c);
|
||||||
|
|
||||||
|
} catch (SQLiteException e){
|
||||||
|
Log.w("Exception", e.getMessage());
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
Log.w("name", MAGZINE_COLUMN_NAME);
|
|
||||||
Log.w("cover", MAGZINE_COLUMN_COVER_PATH);
|
|
||||||
db.insert(DATABASE_TABLE_MAGZINES, null,c);
|
|
||||||
|
|
||||||
} catch (SQLiteException e){
|
|
||||||
Log.w("Exception", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void deleteMagzine(Integer id){
|
public void deleteMagzine(Integer id){
|
||||||
@ -320,15 +327,20 @@ public class LocalStorage extends SQLiteOpenHelper {
|
|||||||
//c.put(ARTICLE_COLUMN_AUTHOR_ID, 1);
|
//c.put(ARTICLE_COLUMN_AUTHOR_ID, 1);
|
||||||
|
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
|
// int nRowsEffected = db.update(DATABASE_NAME, c, "name = '"+article.getArticleTitle()+"'", null);
|
||||||
|
|
||||||
try{
|
//if(nRowsEffected <= 0) {
|
||||||
|
try{
|
||||||
|
|
||||||
|
db.insert(DATABASE_TABLE_ARTICLES, null,c);
|
||||||
|
// Log.w("Inserting...", String.valueOf( db.insert(DATABASE_TABLE_ARTICLES, null,c)));
|
||||||
|
|
||||||
|
} catch (SQLiteException e){
|
||||||
|
Log.w("Exception", e.getMessage());
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
db.insert(DATABASE_TABLE_ARTICLES, null,c);
|
|
||||||
// Log.w("Inserting...", String.valueOf( db.insert(DATABASE_TABLE_ARTICLES, null,c)));
|
|
||||||
|
|
||||||
} catch (SQLiteException e){
|
|
||||||
Log.w("Exception", e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void updateArticle(Article article){
|
public void updateArticle(Article article){
|
||||||
@ -393,6 +405,23 @@ public class LocalStorage extends SQLiteOpenHelper {
|
|||||||
db.close();
|
db.close();
|
||||||
|
|
||||||
return article;
|
return article;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkArticle(String name) {
|
||||||
|
|
||||||
|
SQLiteDatabase db = getReadableDatabase();
|
||||||
|
|
||||||
|
String query = "Select * from " + DATABASE_TABLE_ARTICLES+" where title = \""+name+"\"";
|
||||||
|
Cursor c = db.rawQuery(query, null);
|
||||||
|
c.moveToFirst();
|
||||||
|
if(c.getCount() > 0){
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public ArrayList<Article> getMagazineArticles(Integer magazineID)
|
public ArrayList<Article> getMagazineArticles(Integer magazineID)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
package com.example.manan.enhancedurdureader.Fragments;
|
package com.example.manan.enhancedurdureader.Fragments;
|
||||||
|
|
||||||
|
import android.Manifest;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.support.v4.app.Fragment;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -15,19 +20,15 @@ import android.widget.TextSwitcher;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ViewSwitcher;
|
import android.widget.ViewSwitcher;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
|
||||||
import com.example.manan.enhancedurdureader.Activities.ArticleReadingActivity;
|
|
||||||
import com.example.manan.enhancedurdureader.Activities.EpubReaderActivity;
|
import com.example.manan.enhancedurdureader.Activities.EpubReaderActivity;
|
||||||
import com.example.manan.enhancedurdureader.Activities.SegmentedBookReaderActivity;
|
import com.example.manan.enhancedurdureader.Activities.SegmentedBookReaderActivity;
|
||||||
import com.example.manan.enhancedurdureader.Adapters.BooksAdapter;
|
import com.example.manan.enhancedurdureader.Adapters.BooksAdapter;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Book;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Book;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.EpubBook;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.EpubBook;
|
||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.SegmentedBook;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.SegmentedBook;
|
||||||
import com.example.manan.enhancedurdureader.R;
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@ -112,7 +113,26 @@ public class BooksFragment extends Fragment {
|
|||||||
{
|
{
|
||||||
ArrayList<File> bookFiles = new ArrayList<File>();
|
ArrayList<File> bookFiles = new ArrayList<File>();
|
||||||
|
|
||||||
bookFiles = new ArrayList<File>(Arrays.asList(new File("storage/sdcard1/EnhancedBooks/").listFiles()));
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
|
if (ContextCompat.checkSelfPermission(getActivity().getApplicationContext(),android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||||
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
|
bookFiles = new ArrayList<File>(Arrays.asList(new File("/storage/398A-161B/EnhancedBooks/").listFiles()));
|
||||||
|
// Log.v(TAG,"Permission is granted");
|
||||||
|
// return true;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Log.v(TAG,"Permission is revoked");
|
||||||
|
ActivityCompat.requestPermissions(this.getActivity(), new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { //permission is automatically granted on sdk<23 upon installation
|
||||||
|
bookFiles = new ArrayList<File>(Arrays.asList(new File("/storage/398A-161B/EnhancedBooks/").listFiles()));
|
||||||
|
// Log.v(TAG,"Permission is granted");
|
||||||
|
//return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bookFiles = new ArrayList<File>(Arrays.asList(new File("/storage/398A-161B/EnhancedBooks/").listFiles()));
|
||||||
|
|
||||||
for(File bookFile:bookFiles)
|
for(File bookFile:bookFiles)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import com.example.manan.enhancedurdureader.ApplicationEntities.Article;
|
|||||||
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
import com.example.manan.enhancedurdureader.ApplicationEntities.Magazine;
|
||||||
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
import com.example.manan.enhancedurdureader.DataStorage.LocalStorage;
|
||||||
import com.example.manan.enhancedurdureader.R;
|
import com.example.manan.enhancedurdureader.R;
|
||||||
|
import com.salesforce.androidsdk.rest.RestClient;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -49,6 +50,8 @@ public class MagazinesFragment extends Fragment {
|
|||||||
|
|
||||||
LocalStorage db = null;
|
LocalStorage db = null;
|
||||||
|
|
||||||
|
RestClient client;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
magazinesAndArticlesView = inflater.inflate(R.layout.magazines_fragment, container, false);
|
magazinesAndArticlesView = inflater.inflate(R.layout.magazines_fragment, container, false);
|
||||||
@ -222,6 +225,8 @@ public class MagazinesFragment extends Fragment {
|
|||||||
|
|
||||||
articles.add(art);
|
articles.add(art);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011-present, salesforce.com, inc.
|
||||||
|
* All rights reserved.
|
||||||
|
* Redistribution and use of this software in source and binary forms, with or
|
||||||
|
* without modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* - Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* - Neither the name of salesforce.com, inc. nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission of salesforce.com, inc.
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package com.example.manan.enhancedurdureader;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
|
||||||
|
import com.example.manan.enhancedurdureader.Activities.SalesforceDownloadActivity;
|
||||||
|
import com.salesforce.androidsdk.analytics.security.Encryptor;
|
||||||
|
import com.salesforce.androidsdk.app.SalesforceSDKManager;
|
||||||
|
import com.salesforce.androidsdk.app.SalesforceSDKManager.KeyInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Application class for our application.
|
||||||
|
*/
|
||||||
|
public class MainApplication extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
SalesforceSDKManager.initNative(getApplicationContext(), new NativeKeyImpl(), SalesforceDownloadActivity.class);
|
||||||
|
|
||||||
|
//Toast.makeText(this.getApplicationContext(), "Opening", Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Un-comment the line below to enable push notifications in this app.
|
||||||
|
* Replace 'pnInterface' with your implementation of 'PushNotificationInterface'.
|
||||||
|
* Add your Google package ID in 'bootonfig.xml', as the value
|
||||||
|
* for the key 'androidPushNotificationClientId'.
|
||||||
|
*/
|
||||||
|
// SalesforceSDKManager.getInstance().setPushNotificationReceiver(pnInterface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NativeKeyImpl implements KeyInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey(String name) {
|
||||||
|
return Encryptor.hash(name + "12s9adpahk;n12-97sdainkasd=012", name + "12kl0dsakj4-cxh1qewkjasdol8");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,7 +13,7 @@
|
|||||||
android:id="@+id/article_read_act_title"
|
android:id="@+id/article_read_act_title"
|
||||||
android:textSize="30dp" />
|
android:textSize="30dp" />
|
||||||
|
|
||||||
<com.example.manan.enhancedurdureader.CustomViews.NastaleeqTextView
|
<WebView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scrollbars="vertical|horizontal"
|
android:scrollbars="vertical|horizontal"
|
||||||
@ -26,7 +26,7 @@
|
|||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:id="@+id/article_read_act_body"
|
android:id="@+id/article_read_act_body"
|
||||||
android:textSize="22dp" />
|
android:textSize="22dp" />
|
||||||
<android.support.design.widget.FloatingActionButton
|
<!-- <android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/publish_article"
|
android:id="@+id/publish_article"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -37,7 +37,7 @@
|
|||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="12dp" />
|
android:layout_marginEnd="12dp" />-->
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/voting_bar"
|
android:id="@+id/voting_bar"
|
||||||
@ -49,7 +49,7 @@
|
|||||||
android:layout_below="@id/article_read_act_body">
|
android:layout_below="@id/article_read_act_body">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<TextView
|
<TextView
|
||||||
@ -67,10 +67,10 @@
|
|||||||
android:layout_weight="0.8"
|
android:layout_weight="0.8"
|
||||||
android:src="@drawable/upvote_icon"/>
|
android:src="@drawable/upvote_icon"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout> -->
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<!-- <LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@ -88,7 +88,7 @@
|
|||||||
android:text="0"
|
android:text="0"
|
||||||
android:layout_weight="0.2"
|
android:layout_weight="0.2"
|
||||||
android:id="@+id/total_downvotes"/>
|
android:id="@+id/total_downvotes"/>
|
||||||
</LinearLayout>
|
</LinearLayout> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8
app/src/main/res/layout/salesforce_layout.xml
Normal file
8
app/src/main/res/layout/salesforce_layout.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -13,4 +13,10 @@
|
|||||||
android:title="New Article"
|
android:title="New Article"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_refresh"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="Refresh"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@ -4,7 +4,23 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/action_edit_article"
|
android:id="@+id/action_edit_article"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="AddCover"
|
android:title="Edit Article"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_upload_article"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="Publish Article"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_upvote"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="Upvote Article"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_downvote"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="Downvote Article"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
app/src/main/res/values-v21/bootconfig.xml
Normal file
10
app/src/main/res/values-v21/bootconfig.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<string name="remoteAccessConsumerKey">3MVG9Iu66FKeHhINkB1l7xt7kR8czFcCTUhgoA8Ol2Ltf1eYHOU4SqQRSEitYFDUpqRWcoQ2.dBv_a1Dyu5xa</string>
|
||||||
|
<string name="oauthRedirectURI">testsfdc:///mobilesdk/detect/oauth/done</string>
|
||||||
|
<string-array name="oauthScopes">
|
||||||
|
<item>api</item>
|
||||||
|
</string-array>
|
||||||
|
<string name="androidPushNotificationClientId"></string>
|
||||||
|
</resources>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">EnhancedUrduReader</string>
|
<string name="app_name">Enhanced Urdu Reader</string>
|
||||||
|
|
||||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
include ':app', ':epublib-core-latest'
|
include ':app', ':epublib-core-latest', ':SalesforceSDK', ':SmartSync', ':SalesforceAnalytics', ':SmartStore'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user