mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Added zimtest using a mocked JNI
This commit is contained in:
parent
1e517659a9
commit
8efac394b7
@ -43,11 +43,15 @@ dependencies {
|
||||
compile project(":kiwixlib")
|
||||
|
||||
apt "com.google.dagger:dagger-compiler:2.0.2"
|
||||
androidTestApt "com.google.dagger:dagger-compiler:2.0.2"
|
||||
|
||||
compile 'com.yahoo.squidb:squidb:2.0.0'
|
||||
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
|
||||
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
|
||||
|
||||
compile 'commons-io:commons-io:2.5'
|
||||
|
||||
|
||||
compile 'com.squareup.okhttp3:okhttp:3.4.1'
|
||||
compile 'com.squareup.retrofit2:retrofit:2.1.0'
|
||||
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
|
||||
|
@ -0,0 +1,24 @@
|
||||
package org.kiwix.kiwixmobile.di.components;
|
||||
|
||||
import android.support.test.espresso.core.deps.dagger.Module;
|
||||
import dagger.Component;
|
||||
import javax.inject.Singleton;
|
||||
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
|
||||
import org.kiwix.kiwixmobile.di.modules.NetworkModule;
|
||||
import org.kiwix.kiwixmobile.di.modules.TestModule;
|
||||
import org.kiwix.kiwixmobile.utils.ZimTest;
|
||||
|
||||
/**
|
||||
* Created by mhutti1 on 13/04/17.
|
||||
*/
|
||||
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
ApplicationModule.class,
|
||||
NetworkModule.class,
|
||||
TestModule.class,
|
||||
})
|
||||
public interface TestComponent extends ApplicationComponent {
|
||||
|
||||
void inject(ZimTest zimTest);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package org.kiwix.kiwixmobile.di.modules;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
|
||||
import android.content.Context;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.inject.Singleton;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.kiwix.kiwixlib.JNIKiwix;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
/**
|
||||
* Created by mhutti1 on 13/04/17.
|
||||
*/
|
||||
|
||||
@Module
|
||||
public class TestModule{
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public JNIKiwix providesJNIKiwix(Context context) {
|
||||
JNIKiwix jniKiwix = Mockito.mock(JNIKiwix.class);
|
||||
try {
|
||||
InputStream inStream = TestModule.class.getClassLoader().getResourceAsStream("summary");
|
||||
byte[] summary = IOUtils.toByteArray(inStream);
|
||||
InputStream inStream2 = TestModule.class.getClassLoader().getResourceAsStream("testpage");
|
||||
byte[] fool = IOUtils.toByteArray(inStream2);
|
||||
doReturn(summary).when(jniKiwix).getContent(eq("A/index.htm"),any(),any());
|
||||
doReturn(fool).when(jniKiwix).getContent(eq("A/A_Fool_for_You.html"),any(),any());
|
||||
doReturn("A/index.htm").when(jniKiwix).getMainPage();
|
||||
doReturn(true).when(jniKiwix).loadZIM(any());
|
||||
doReturn(true).when(jniKiwix).loadFulltextIndex(any());
|
||||
doReturn("mockid").when(jniKiwix).getId();
|
||||
doReturn("mockname").when(jniKiwix).getName();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return jniKiwix;
|
||||
}
|
||||
|
||||
}
|
@ -22,8 +22,11 @@ import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.hasToString;
|
||||
import static org.hamcrest.core.StringStartsWith.startsWith;
|
||||
import static org.kiwix.kiwixmobile.library.LibraryAdapter.parseURL;
|
||||
import static org.kiwix.kiwixmobile.utils.NetworkUtils.parseURL;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.test.espresso.ViewInteraction;
|
||||
import android.support.test.espresso.action.ViewActions;
|
||||
import android.support.test.espresso.contrib.DrawerActions;
|
||||
@ -36,7 +39,10 @@ import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.bytebuddy.matcher.StringMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
@ -45,7 +51,15 @@ import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.kiwix.kiwixmobile.KiwixApplication;
|
||||
import org.kiwix.kiwixmobile.KiwixMobileActivity;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
import org.kiwix.kiwixmobile.ZimContentProvider;
|
||||
import org.kiwix.kiwixmobile.di.components.DaggerApplicationComponent;
|
||||
import org.kiwix.kiwixmobile.di.components.DaggerTestComponent;
|
||||
import org.kiwix.kiwixmobile.di.components.TestComponent;
|
||||
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
|
||||
import org.kiwix.kiwixmobile.di.modules.TestModule;
|
||||
import org.kiwix.kiwixmobile.library.LibraryAdapter;
|
||||
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity.Book;
|
||||
import org.kiwix.kiwixmobile.testutils.TestUtils;
|
||||
@ -54,13 +68,44 @@ import org.kiwix.kiwixmobile.testutils.TestUtils;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ZimTest {
|
||||
|
||||
@Inject
|
||||
Context context;
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<SplashActivity> mActivityTestRule = new ActivityTestRule<>(
|
||||
SplashActivity.class);
|
||||
public ActivityTestRule<KiwixMobileActivity> mActivityTestRule = new ActivityTestRule<>(
|
||||
KiwixMobileActivity.class, false, false);
|
||||
|
||||
@Before public void setUp() {
|
||||
TestComponent component = DaggerTestComponent.builder().applicationModule
|
||||
(new ApplicationModule(
|
||||
(KiwixApplication) getInstrumentation().getTargetContext().getApplicationContext())).build();
|
||||
|
||||
((KiwixApplication) getInstrumentation().getTargetContext().getApplicationContext()).setApplicationComponent(component);
|
||||
|
||||
component.inject(this);
|
||||
new ZimContentProvider().setupDagger();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void zimTest() {
|
||||
ViewInteraction appCompatButton = onView(
|
||||
Intent intent = new Intent();
|
||||
File file = new File(context.getFilesDir(), "test.zim");
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
intent.setData(Uri.fromFile(file));
|
||||
|
||||
mActivityTestRule.launchActivity(intent);
|
||||
|
||||
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
|
||||
|
||||
onView(withText("Home"))
|
||||
.perform(click());
|
||||
|
||||
/*ViewInteraction appCompatButton = onView(
|
||||
allOf(withId(R.id.get_content_card), withText("Get Content")));
|
||||
appCompatButton.perform(scrollTo(), click());
|
||||
|
||||
@ -76,7 +121,9 @@ public class ZimTest {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
onData(withContent("ray charles")).inAdapterView(withId(R.id.zimfilelist)).perform(click());
|
||||
onData(withContent("ray charles")).inAdapterView(withId(R.id.zimfilelist)).perform(click());*/
|
||||
|
||||
|
||||
|
||||
onWebView().withElement(findElement(Locator.LINK_TEXT, "A Fool for You"));
|
||||
|
||||
@ -157,7 +204,7 @@ public class ZimTest {
|
||||
return new BoundedMatcher<Object, Book>(Book.class) {
|
||||
@Override
|
||||
public boolean matchesSafely(Book myObj) {
|
||||
return parseURL(myObj.file.getPath()).equals(content);
|
||||
return parseURL(getInstrumentation().getTargetContext(), myObj.file.getPath()).equals(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
102
app/src/androidTestKiwix/resources/summary
Normal file
102
app/src/androidTestKiwix/resources/summary
Normal file
@ -0,0 +1,102 @@
|
||||
<html><head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Summary</title>
|
||||
<link rel="stylesheet" href="../-/s/style.css">
|
||||
<script src="../-/j/head.js"></script>
|
||||
</head>
|
||||
<body class="mw-body mw-body-content mediawiki" style="background-color: white; margin: 0; border-width: 0px; padding: 0px;">
|
||||
<div id="content" class="mw-body" style="margin: 0; padding: 1em; border-width: 0px;">
|
||||
<a id="top"></a>
|
||||
<h1 id="titleHeading" style="background-color: white; margin: 0;">Summary</h1>
|
||||
<div id="mw-content-text"><ul>
|
||||
<li><a href="A_Fool_for_You.html">A Fool for You</a><a></a></li><a>
|
||||
</a><li><a></a><a href="A_Man_and_His_Soul.html">A Man and His Soul</a><a></a></li><a>
|
||||
</a><li><a></a><a href="America_the_Beautiful.html">America the Beautiful</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Baby_Grand.html">Baby Grand</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Bein'_Green.html">Bein' Green</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Betty_Carter.html">Betty Carter</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Busted_(Johnny_Cash_song).html">Busted (Johnny Cash song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Bye_Bye_Love_(The_Everly_Brothers_song).html">Bye Bye Love (The Everly Brothers song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Come_Back_Baby.html">Come Back Baby</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Cry_(Churchill_Kohlman_song).html">Cry (Churchill Kohlman song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Crying_Time.html">Crying Time</a><a></a></li><a>
|
||||
</a><li><a></a><a href="David_%22Fathead%22_Newman.html">David "Fathead" Newman</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Dedicated_to_You_(Ray_Charles_album).html">Dedicated to You (Ray Charles album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Do_the_Twist!_with_Ray_Charles.html">Do the Twist! with Ray Charles</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Driftin'_Blues.html">Driftin' Blues</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Drown_in_My_Own_Tears.html">Drown in My Own Tears</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Eleanor_Rigby.html">Eleanor Rigby</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Fathead_(album).html">Fathead (album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Genius_%26_Friends.html">Genius & Friends</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Genius_Loves_Company.html">Genius Loves Company</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Georgia_on_My_Mind.html">Georgia on My Mind</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Hallelujah_I_Love_Her_So.html">Hallelujah I Love Her So</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Hank_Crawford.html">Hank Crawford</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Have_a_Smile_with_Me.html">Have a Smile with Me</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Heaven_Knows_(Taylor_Hicks_song).html">Heaven Knows (Taylor Hicks song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Hit_the_Road_Jack.html">Hit the Road Jack</a><a></a></li><a>
|
||||
</a><li><a></a><a href="I'm_Moving_On_(Hank_Snow_song).html">I'm Moving On (Hank Snow song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="I_Can't_Stop_Loving_You.html">I Can't Stop Loving You</a><a></a></li><a>
|
||||
</a><li><a></a><a href="I_Don't_Need_No_Doctor.html">I Don't Need No Doctor</a><a></a></li><a>
|
||||
</a><li><a></a><a href="I_Got_a_Woman.html">I Got a Woman</a><a></a></li><a>
|
||||
</a><li><a></a><a href="In_the_Heat_of_the_Night_(Ray_Charles_song).html">In the Heat of the Night (Ray Charles song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ingredients_in_a_Recipe_for_Soul.html">Ingredients in a Recipe for Soul</a><a></a></li><a>
|
||||
</a><li><a></a><a href="It_Should've_Been_Me_(Memphis_Curtis_song).html">It Should've Been Me (Memphis Curtis song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Let's_Go_Get_Stoned_(R%26B_song).html">Let's Go Get Stoned (R&B song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Let_the_Good_Times_Roll_(Louis_Jordan_song).html">Let the Good Times Roll (Louis Jordan song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="List_of_accolades_received_by_Ray_(film).html">List of accolades received by Ray (film)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Live_in_Concert_(Ray_Charles_album).html">Live in Concert (Ray Charles album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Lonely_Avenue.html">Lonely Avenue</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Love_Affair_(1994_film).html">Love Affair (1994 film)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Mess_Around.html">Mess Around</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Modern_Sounds_in_Country_and_Western_Music.html">Modern Sounds in Country and Western Music</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Modern_Sounds_in_Country_and_Western_Music_Volume_Two.html">Modern Sounds in Country and Western Music Volume Two</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Night_Time_Is_the_Right_Time.html">Night Time Is the Right Time</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Quincy_Jones.html">Quincy Jones</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_(film).html">Ray (film)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles.html">Ray Charles</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_(album).html">Ray Charles (album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_Anthology.html">Ray Charles Anthology</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_Greatest_Hits.html">Ray Charles Greatest Hits</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_Live.html">Ray Charles Live</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_and_Betty_Carter.html">Ray Charles and Betty Carter</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_at_Newport.html">Ray Charles at Newport</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_discography.html">Ray Charles discography</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_in_Concert.html">Ray Charles in Concert</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Charles_in_Person.html">Ray Charles in Person</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Ray_Sings%2C_Basie_Swings.html">Ray Sings, Basie Swings</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Shake_a_Tail_Feather.html">Shake a Tail Feather</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Side_by_Side_(1927_song).html">Side by Side (1927 song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Soul_Brothers.html">Soul Brothers</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Soul_Meeting.html">Soul Meeting</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Spy_Hard.html">Spy Hard</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Strong_Love_Affair.html">Strong Love Affair</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Sweet_%26_Sour_Tears.html">Sweet & Sour Tears</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Talkin'_'bout_You.html">Talkin' 'bout You</a><a></a></li><a>
|
||||
</a><li><a></a><a href="That_Lucky_Old_Sun.html">That Lucky Old Sun</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Best_of_Ray_Charles.html">The Best of Ray Charles</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Birth_of_Soul.html">The Birth of Soul</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Blues_Brothers_(film).html">The Blues Brothers (film)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Genius_After_Hours.html">The Genius After Hours</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Genius_Hits_the_Road.html">The Genius Hits the Road</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Genius_Sings_the_Blues.html">The Genius Sings the Blues</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Genius_of_Ray_Charles.html">The Genius of Ray Charles</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Great_Ray_Charles.html">The Great Ray Charles</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Long_and_Winding_Road.html">The Long and Winding Road</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Nanny.html">The Nanny</a><a></a></li><a>
|
||||
</a><li><a></a><a href="The_Raelettes.html">The Raelettes</a><a></a></li><a>
|
||||
</a><li><a></a><a href="This_Little_Girl_of_Mine.html">This Little Girl of Mine</a><a></a></li><a>
|
||||
</a><li><a></a><a href="True_to_Life.html">True to Life</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Unchain_My_Heart_(song).html">Unchain My Heart (song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="What'd_I_Say.html">What'd I Say</a><a></a></li><a>
|
||||
</a><li><a></a><a href="What'd_I_Say_(album).html">What'd I Say (album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="Yes_Indeed!_(Ray_Charles_album).html">Yes Indeed! (Ray Charles album)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="You_Don't_Know_Me_(Eddy_Arnold_song).html">You Don't Know Me (Eddy Arnold song)</a><a></a></li><a>
|
||||
</a><li><a></a><a href="You_Got_the_Right_One%2C_Baby.html">You Got the Right One, Baby</a><a></a></li><a>
|
||||
</a></ul><a>
|
||||
</a></div>
|
||||
</div>
|
||||
<script src="../-/j/body.js"></script>
|
||||
|
||||
|
||||
</body></html>
|
179
app/src/androidTestKiwix/resources/testpage
Normal file
179
app/src/androidTestKiwix/resources/testpage
Normal file
@ -0,0 +1,179 @@
|
||||
<html><head>
|
||||
<meta charset="UTF-8">
|
||||
<title>A Fool for You</title>
|
||||
<link rel="stylesheet" href="../-/s/style.css">
|
||||
<script src="../-/j/head.js"></script>
|
||||
</head>
|
||||
<body class="mw-body mw-body-content mediawiki" style="background-color: white; margin: 0; border-width: 0px; padding: 0px;">
|
||||
<div id="content" class="mw-body" style="margin: 0; padding: 1em; border-width: 0px;">
|
||||
<a id="top"></a>
|
||||
<h1 id="titleHeading" style="background-color: white; margin: 0;">A Fool for You</h1>
|
||||
<div id="mw-content-text">
|
||||
<table class="infobox vevent" style="width:22em" id="mwEA"><tbody><tr id="mwEQ"><th colspan="2" class="summary" style="text-align:center;font-size:125%;font-weight:bold;background-color:#F0E68C" id="mwEg">"A Fool for You"</th></tr><tr class="description" id="mwEw"><th colspan="2" class="description" style="text-align:center;background-color:#F0E68C" id="mwFA">Single<span> </span>by <a href="Ray_Charles.html" title="Ray Charles" id="mwFg">Ray Charles</a></th></tr><tr class="description" id="mwFw"><th colspan="2" class="description" style="text-align:center;background-color:#F0E68C" id="mwGA">from the album <i><a href="Ray_Charles_(or%2C_Hallelujah_I_Love_Her_So).html" title="Ray Charles (or, Hallelujah I Love Her So)" id="mwGQ">Ray Charles (or, Hallelujah I Love Her So)</a></i></th></tr><tr id="mwGg"><th scope="row" style="text-align:left" id="mwGw">Released</th><td id="mwHA">
|
||||
1955</td></tr><tr id="mwHQ"><th scope="row" style="text-align:left" id="mwHg">Recorded</th><td id="mwHw">
|
||||
1954-1955</td></tr><tr id="mwIA"><th scope="row" style="text-align:left" id="mwIQ">Genre</th><td id="mwIw">
|
||||
Soul blues</td></tr><tr id="mwJQ"><th scope="row" style="text-align:left" id="mwJg">Length</th><td id="mwJw">
|
||||
3:03</td></tr><tr id="mwKA"><th scope="row" style="text-align:left" id="mwKQ">Label</th><td id="mwKw">
|
||||
Atlantic</td></tr><tr id="mwLQ"><th scope="row" style="text-align:left" id="mwLg"><span style="white-space: nowrap;" id="mwLw">Writer(s)</span></th><td id="mwMQ">
|
||||
<a href="Ray_Charles.html" title="Ray Charles" id="mwMg">Ray Charles</a></td></tr><tr id="mwMw"><th scope="row" style="text-align:left" id="mwNA"><span style="white-space: nowrap;" id="mwNQ">Producer(s)</span></th><td id="mwNw">
|
||||
Jerry Wexler</td></tr><tr id="mwOQ"><th colspan="2" class="description" style="text-align:center;background-color:#F0E68C" id="mwOg"><a href="Ray_Charles.html" title="Ray Charles" id="mwOw">Ray Charles</a><span> </span>singles<span> </span>chronology</th></tr><tr id="mwPA"><td colspan="2" style="text-align:center" id="mwPQ">
|
||||
|
||||
<table style="width:100%; background: transparent; text-align: center; line-height: 1.4em; vertical-align: top">
|
||||
<tbody><tr><td style="width:33%; padding:.2em .1em .2em 0"> "Greenbacks"<br id="mwPg">(1955)</td>
|
||||
<td style="width:33%; padding:.2em .1em"> "<b>A Fool for You</b>"<br id="mwPw">(1955)</td>
|
||||
<td style="width:33%; padding:.2em 0 .2em .1em"> "<a href="Hallelujah_I_Love_Her_So.html" title="Hallelujah I Love Her So" id="mwQA">Hallelujah I Love Her So</a>"<br id="mwQQ">(1956)</td></tr>
|
||||
</tbody></table></td></tr></tbody></table>
|
||||
<p id="mwQg">"<b id="mwQw">A Fool for You</b>" is a bluesy, proto-soul single recording written by <a href="Ray_Charles.html" title="Ray Charles" id="mwRg">Ray Charles</a> and released by him in 1955 on the Atlantic label.</p>
|
||||
|
||||
<h2 id="mwSA">Personnel</h2>
|
||||
|
||||
<ul id="mwSQ"><li id="mwSg">Lead vocal and piano by Ray Charles</li>
|
||||
<li id="mwSw">Instrumentation by the Ray Charles band</li>
|
||||
<li id="mwTA">Produced by Jerry Wexler</li></ul>
|
||||
|
||||
<h2 id="mwTg">Covers</h2>
|
||||
<ul id="mwTw"><li id="mwUA">Otis Redding on <i id="mwUg">The Immortal Otis Redding</i></li>
|
||||
<li id="mwVA">Van Morrison on <i id="mwVg">A Night in San Francisco</i></li>
|
||||
<li id="mwWA">Michael Jackson on <i id="mwWg">Soulsation!</i></li></ul>
|
||||
|
||||
<table class="navbox" style="border-spacing:0" id="mwXA"><tbody><tr id="mwXQ"><td style="padding:2px" id="mwXg"><table class="nowraplinks vcard hlist collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit" id="mwXw"><tbody><tr id="mwYA"><th scope="col" class="navbox-title" colspan="2" style="background: #f0e68c;" id="mwYQ"><div class="fn" style="font-size:110%" id="mwbA"><a href="Ray_Charles.html" title="Ray Charles" id="mwbQ">Ray Charles</a></div></th></tr><tr style="height:2px" id="mwbg"><td colspan="2" id="mwbw"></td></tr><tr id="mwcA"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwcQ">Studio albums</th><td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwcg"><div style="padding:0em 0.25em" id="mwcw">
|
||||
<ul><li> <i><a href="Ray_Charles_(album).html" title="Ray Charles (album)" id="mwdA">Ray Charles (Hallelujah, I Love Her So)</a></i></li>
|
||||
<li> <i><a href="The_Great_Ray_Charles.html" title="The Great Ray Charles" id="mwdQ">The Great Ray Charles</a></i></li>
|
||||
<li> <i><a href="Yes_Indeed!_(Ray_Charles_album).html" title="Yes Indeed! (Ray Charles album)" id="mwdg">Yes Indeed!</a></i></li>
|
||||
<li> <i><a href="Soul_Brothers.html" title="Soul Brothers" id="mwdw">Soul Brothers</a></i></li>
|
||||
<li> <i><a href="What'd_I_Say_(album).html" title="What'd I Say (album)" id="mweA">What'd I Say</a></i></li>
|
||||
<li> <i><a href="The_Genius_of_Ray_Charles.html" title="The Genius of Ray Charles" id="mweQ">The Genius of Ray Charles</a></i></li>
|
||||
<li> <i>Genius+Soul = Jazz</i></li>
|
||||
<li> <i><a href="The_Genius_Hits_the_Road.html" title="The Genius Hits the Road" id="mwew">The Genius Hits the Road</a></i></li>
|
||||
<li> <i><a href="Dedicated_to_You_(Ray_Charles_album).html" title="Dedicated to You (Ray Charles album)" id="mwfA">Dedicated to You</a></i></li>
|
||||
<li> <i><a href="Ray_Charles_and_Betty_Carter.html" title="Ray Charles and Betty Carter" id="mwfQ">Ray Charles and Betty Carter</a></i></li>
|
||||
<li> <i><a href="The_Genius_Sings_the_Blues.html" title="The Genius Sings the Blues" id="mwfg">The Genius Sings the Blues</a></i></li>
|
||||
<li> <i><a href="Soul_Meeting.html" title="Soul Meeting" id="mwfw">Soul Meeting</a></i></li>
|
||||
<li> <i><a href="The_Genius_After_Hours.html" title="The Genius After Hours" id="mwgA">The Genius After Hours</a></i></li>
|
||||
<li> <i><a href="Ray_Charles_Greatest_Hits.html" title="Ray Charles Greatest Hits" id="mwgQ">Ray Charles Greatest Hits</a></i></li>
|
||||
<li> <i><a href="Modern_Sounds_in_Country_and_Western_Music.html" title="Modern Sounds in Country and Western Music" id="mwgg">Modern Sounds in Country and Western Music</a></i></li>
|
||||
<li> <i><a href="Modern_Sounds_in_Country_and_Western_Music_Volume_Two.html" title="Modern Sounds in Country and Western Music Volume Two" id="mwgw">Modern Sounds in Country and Western Music, Vol. 2</a></i></li>
|
||||
<li> <i><a href="Ingredients_in_a_Recipe_for_Soul.html" title="Ingredients in a Recipe for Soul" id="mwhA">Ingredients in a Recipe for Soul</a></i></li>
|
||||
<li> <i><a href="Sweet_%26_Sour_Tears.html" title="Sweet & Sour Tears" id="mwhQ">Sweet & Sour Tears</a></i></li>
|
||||
<li> <i><a href="Have_a_Smile_with_Me.html" title="Have a Smile with Me" id="mwhg">Have a Smile with Me</a></i></li>
|
||||
<li> <i>Together Again / Country and Western Meets Rhythm and Blues</i></li>
|
||||
<li> <i>Crying Time</i></li>
|
||||
<li> <i>Ray's Moods</i></li>
|
||||
<li> <i>Ray Charles Invites You to Listen</i></li>
|
||||
<li> <i>A Portrait of Ray</i></li>
|
||||
<li> <i>I'm All Yours Baby!</i></li>
|
||||
<li> <i>Doing His Thing</i></li>
|
||||
<li> <i>My Kind of Jazz</i></li>
|
||||
<li> <i>Love Country Style</i></li>
|
||||
<li> <i>Volcanic Action of My Soul</i></li>
|
||||
<li> <i>A Message From the People</i></li>
|
||||
<li> <i>Through the Eyes of Love</i></li>
|
||||
<li> <i>Jazz Number II</i></li>
|
||||
<li> <i>Come Live With Me</i></li>
|
||||
<li> <i>Renaissance</i></li>
|
||||
<li> <i>My Kind of Jazz Part 3</i></li>
|
||||
<li> <i>Porgy and Bess with Cleo Laine</i></li>
|
||||
<li> <i><a href="True_to_Life.html" title="True to Life" id="mwkw">True to Life</a></i></li>
|
||||
<li> <i>Love & Peace</i></li>
|
||||
<li> <i>Ain't It So</i></li>
|
||||
<li> <i>Brother Ray Is at It Again</i></li>
|
||||
<li> <i>Wish You Were Here Tonight</i></li>
|
||||
<li> <i>Do I Ever Cross Your Mind?</i></li>
|
||||
<li> <i>Friendship</i></li>
|
||||
<li> <i>The Spirit of Christmas</i></li>
|
||||
<li> <i>From the Pages of My Mind</i></li>
|
||||
<li> <i>Just Between Us</i></li>
|
||||
<li> <i>Would You Believe?</i></li>
|
||||
<li> <i>My World</i></li>
|
||||
<li> <i>Strong Love Affair</i></li>
|
||||
<li> <i>Thanks for Bringing Love Around Again</i></li>
|
||||
<li> <i><a href="Genius_Loves_Company.html" title="Genius Loves Company" id="mwlg">Genius Loves Company</a></i></li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mwlw"><td colspan="2" id="mwmA"></td></tr><tr id="mwmQ"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwmg">Posthumous <br id="mwmw">studio creations</th><td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwnA"><div style="padding:0em 0.25em" id="mwnQ">
|
||||
<ul><li> <i><a href="Genius_%26_Friends.html" title="Genius & Friends" id="mwng">Genius & Friends</a></i></li>
|
||||
<li> <i><a href="Ray_Sings%2C_Basie_Swings.html" title="Ray Sings, Basie Swings" id="mwnw">Ray Sings, Basie Swings</a></i></li>
|
||||
<li> <i>Rare Genius</i></li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mwoQ"><td colspan="2" id="mwog"></td></tr><tr id="mwow"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwpA">Live albums</th><td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwpQ"><div style="padding:0em 0.25em" id="mwpg">
|
||||
<ul><li> <i><a href="Ray_Charles_at_Newport.html" title="Ray Charles at Newport" id="mwpw">Ray Charles at Newport</a></i></li>
|
||||
<li> <i><a href="Ray_Charles_in_Person.html" title="Ray Charles in Person" id="mwqA">Ray Charles in Person</a></i></li>
|
||||
<li> <i><a href="Live_in_Concert_(Ray_Charles_album).html" title="Live in Concert (Ray Charles album)" id="mwqQ">Live in Concert</a></i></li>
|
||||
<li> <i>Live in Japan</i></li>
|
||||
<li> <i><a href="Ray_Charles_Live.html" title="Ray Charles Live" id="mwqg">Ray Charles Live</a></i></li>
|
||||
<li> <i>Berlin, '62</i></li>
|
||||
<li> <i>Ray Charles Celebrates a Gospel Christmas with the Voices of Jubilation</i></li>
|
||||
<li> <i>Live at the Olympia, 2000</i></li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mwqw"><td colspan="2" id="mwrA"></td></tr><tr id="mwrQ"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwrg">Notable <br id="mwrw">compilations</th><td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwsA"><div style="padding:0em 0.25em" id="mwsQ">
|
||||
<ul><li> <i><a href="Do_the_Twist!_with_Ray_Charles.html" title="Do the Twist! with Ray Charles" id="mwsg">Do the Twist! with Ray Charles</a></i></li>
|
||||
<li> <i>The Ray Charles Story, Vol 1~4</i></li>
|
||||
<li> <i><a href="A_Man_and_His_Soul.html" title="A Man and His Soul" id="mwsw">A Man and His Soul</a></i></li>
|
||||
<li> <i><a href="The_Best_of_Ray_Charles.html" title="The Best of Ray Charles" id="mwtA">The Best of Ray Charles</a></i></li>
|
||||
<li> <i><a href="Ray_Charles_Anthology.html" title="Ray Charles Anthology" id="mwtQ">Anthology</a></i></li>
|
||||
<li> <i>Seven Spanish Angels and Other Hits</i></li>
|
||||
<li> <i><a href="The_Birth_of_Soul.html" title="The Birth of Soul" id="mwtg">The Birth of Soul</a></i></li>
|
||||
<li> <i>Genius and Soul</i></li>
|
||||
<li> <i>The Complete Swing Time & Down Beat Recordings</i></li>
|
||||
<li> <i>Ultimate Hits Collection</i></li>
|
||||
<li> <i><a href="Ray_Charles_in_Concert.html" title="Ray Charles in Concert" id="mwtw">Ray Charles in Concert</a></i></li>
|
||||
<li> <i>Pure Genius: The Complete Atlantic Recordings (1952-1959)</i></li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mwuA"><td colspan="2" id="mwuQ"></td></tr><tr id="mwug"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwuw">Billboard Hot 100<br id="mwvA">Top 10 Singles</th><td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwvQ"><div style="padding:0em 0.25em" id="mwvg">
|
||||
<ul><li> "<a href="What'd_I_Say.html" title="What'd I Say" id="mwvw">What'd I Say </a>"</li>
|
||||
<li> "<a href="Georgia_on_My_Mind.html" title="Georgia on My Mind" id="mwwA">Georgia on My Mind </a>"</li>
|
||||
<li> "<a href="Hit_the_Road_Jack.html" title="Hit the Road Jack" id="mwwQ">Hit the Road Jack</a>"</li>
|
||||
<li> "One Mint Julep"</li>
|
||||
<li> "<a href="Unchain_My_Heart_(song).html" title="Unchain My Heart (song)" id="mwww">Unchain My Heart</a>"</li>
|
||||
<li> "<a href="I_Can't_Stop_Loving_You.html" title="I Can't Stop Loving You" id="mwxA">I Can't Stop Loving You </a>"</li>
|
||||
<li> "<a href="You_Don't_Know_Me_(Eddy_Arnold_song).html" title="You Don't Know Me (Eddy Arnold song)" id="mwxQ">You Don't Know Me</a>"</li>
|
||||
<li> "You Are My Sunshine"</li>
|
||||
<li> "<a href="Busted_(Johnny_Cash_song).html" title="Busted (Johnny Cash song)" id="mwxw">Busted</a>"</li>
|
||||
<li> "Take These Chains from My Heart"</li>
|
||||
<li> "<a href="Crying_Time.html" title="Crying Time" id="mwyQ">Crying Time</a>"</li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mwyg"><td colspan="2" id="mwyw"></td></tr><tr id="mwzA"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mwzQ">Other Billboard Charts<br id="mwzg">#1 singles</th><td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mwzw"><div style="padding:0em 0.25em" id="mw0A">
|
||||
<ul><li> "<a href="I_Got_a_Woman.html" title="I Got a Woman" id="mw0Q">I Got a Woman</a>"</li>
|
||||
<li> "<a href="" title="A Fool for You" id="mw0g">A Fool for You</a>"</li>
|
||||
<li> "Mary Ann"</li>
|
||||
<li> "<a href="Drown_in_My_Own_Tears.html" title="Drown in My Own Tears" id="mw1A">Drown in My Own Tears</a>"</li>
|
||||
<li> "Together Again"</li>
|
||||
<li> "<a href="Let's_Go_Get_Stoned_(R%26B_song).html" title="Let's Go Get Stoned (R&B song)" id="mw1g">Let's Go Get Stoned</a>"</li>
|
||||
<li> "Seven Spanish Angels"</li>
|
||||
<li> "I'll Be Good to You"</li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mw2Q"><td colspan="2" id="mw2g"></td></tr><tr id="mw2w"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mw3A">Grammy Awarded Works<br id="mw3Q">(not included above)</th><td class="navbox-list navbox-odd" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mw3g"><div style="padding:0em 0.25em" id="mw3w">
|
||||
<ul><li> "<a href="Let_the_Good_Times_Roll_(Louis_Jordan_song).html" title="Let the Good Times Roll (Louis Jordan song)" id="mw4A">Let The Good Times Roll</a>"</li>
|
||||
<li> "Living for the City"</li>
|
||||
<li> "A Song for You"</li>
|
||||
<li> "Heaven Help Us All "</li>
|
||||
<li> "Here We Go Again"</li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mw5Q"><td colspan="2" id="mw5g"></td></tr><tr id="mw5w"><th scope="row" class="navbox-group" style="background: #EEEEEE;" id="mw6A">See also</th><td class="navbox-list navbox-even" style="text-align:left;border-left-width:2px;border-left-style:solid;width:100%;padding:0px" id="mw6Q"><div style="padding:0em 0.25em" id="mw6g">
|
||||
<ul><li> <a href="Ray_Charles_discography.html" title="Ray Charles discography" id="mw6w">Discography</a></li>
|
||||
<li> <a href="David_%22Fathead%22_Newman.html" title="David "Fathead" Newman" id="mw7A">David "Fathead" Newman</a></li>
|
||||
<li> <i><a href="Fathead_(album).html" title="Fathead (album)" id="mw7Q">Fathead / Ray Charles Sextet</a></i></li>
|
||||
<li> <a href="Hank_Crawford.html" title="Hank Crawford" id="mw7g">Hank Crawford</a></li>
|
||||
<li> <a href="The_Raelettes.html" title="The Raelettes" id="mw7w">The Raelettes</a></li>
|
||||
<li> <i><a href="Ray_(film).html" title="Ray (film)" id="mw8A">Ray</a></i> (soundtrack)</li>
|
||||
<li> <a href="Quincy_Jones.html" title="Quincy Jones" id="mw8g">Quincy Jones</a></li>
|
||||
<li> <i><a href="The_Blues_Brothers_(film).html" title="The Blues Brothers (film)" id="mw8w">The Blues Brothers</a></i></li>
|
||||
<li> <i>Here We Go Again: Celebrating the Genius of Ray Charles</i></li>
|
||||
<li> <i>Tribute to Uncle Ray</i></li>
|
||||
<li> "Confession Blues"</li>
|
||||
<li> Diet Pepsi</li></ul>
|
||||
</div></td></tr><tr style="height:2px" id="mw-A"><td colspan="2" id="mw-Q"></td></tr><tr id="mw-g"><td class="navbox-abovebelow" colspan="2" style="background: #EEEEEE;" id="mw-w"><div id="mw_A">
|
||||
<ul><li> <b><span><span><img src="../I/m/Symbol_book_class2.svg.png" data-file-width="180" data-file-height="185" data-file-type="drawing" height="16" width="16"></span></span> Book</b></li>
|
||||
<li> <b><span><span><img src="../I/m/Folder_Hexagonal_Icon.svg.png" data-file-width="36" data-file-height="31" data-file-type="drawing" height="14" width="16"></span></span> Category</b></li>
|
||||
<li> <b><span><span><img src="../I/m/Commons-logo.svg.png" data-file-width="1024" data-file-height="1376" data-file-type="drawing" height="16" width="12"></span></span> <a href="http://commons.wikimedia.org/wiki/Special:Search/Ray%20Charles" title="commons:Special:Search/Ray Charles" id="mw_w" class="external">Commons</a></b></li>
|
||||
<li> <b><span><span><img src="../I/m/Wikiquote-logo.svg.png" data-file-width="300" data-file-height="355" data-file-type="drawing" height="16" width="13"></span></span> <a href="http://en.wikiquote.org/wiki/Special:Search/Ray%20Charles" title="wikiquote:Special:Search/Ray Charles" id="mwAQA" class="external">Wikiquote</a></b></li></ul>
|
||||
</div></td></tr></tbody></table></td></tr></tbody></table>
|
||||
|
||||
<meta property="mw:PageProp/categorydefaultsort" content="Fool For You, A" id="mwAQE">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div><div style="clear:both; background-image:linear-gradient(180deg, #E8E8E8, white); border-top: dashed 2px #AAAAAA; padding: 0.5em 0.5em 2em 0.5em; margin-top: 1em; direction: ltr;">This article is issued from <a class="external text" href="http://en.wikipedia.org/wiki/A_Fool_for_You?oldid=631819986">Wikipedia</a> - version of the Friday, October 31, 2014. The text is available under the <a class="external text" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution/Share Alike</a> but additional terms may apply for the media files.</div></div></div>
|
||||
</div>
|
||||
<script src="../-/j/body.js"></script>
|
||||
|
||||
|
||||
</body></html>
|
@ -2,6 +2,8 @@ package org.kiwix.kiwixmobile;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import org.kiwix.kiwixmobile.di.components.ApplicationComponent;
|
||||
import org.kiwix.kiwixmobile.di.components.DaggerApplicationComponent;
|
||||
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
|
||||
@ -16,19 +18,30 @@ public class KiwixApplication extends Application {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
application = this;
|
||||
initializeInjector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
}
|
||||
|
||||
private void initializeInjector() {
|
||||
this.applicationComponent = DaggerApplicationComponent.builder()
|
||||
setApplicationComponent(DaggerApplicationComponent.builder()
|
||||
.applicationModule(new ApplicationModule(this))
|
||||
.build();
|
||||
.build());
|
||||
}
|
||||
|
||||
public ApplicationComponent getApplicationComponent() {
|
||||
return this.applicationComponent;
|
||||
}
|
||||
|
||||
public void setApplicationComponent(ApplicationComponent applicationComponent) {
|
||||
Log.d("test", applicationComponent.toString());
|
||||
this.applicationComponent = applicationComponent;
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import org.kiwix.kiwixmobile.utils.files.FileUtils;
|
||||
import org.kiwix.kiwixlib.JNIKiwix;
|
||||
import org.kiwix.kiwixlib.JNIKiwixString;
|
||||
@ -60,7 +61,15 @@ public class ZimContentProvider extends ContentProvider {
|
||||
|
||||
public static String zimFileName;
|
||||
|
||||
private static JNIKiwix jniKiwix;
|
||||
@Inject public static JNIKiwix jniKiwix;
|
||||
|
||||
@Inject public static Context context;
|
||||
|
||||
public void setupDagger() {
|
||||
KiwixApplication.getInstance().getApplicationComponent().inject(this);
|
||||
setIcuDataDirectory();
|
||||
}
|
||||
|
||||
|
||||
private static String getFulltextIndexPath(String file){
|
||||
String[] names = {file, file};
|
||||
@ -313,12 +322,9 @@ public class ZimContentProvider extends ContentProvider {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
jniKiwix = new JNIKiwix();
|
||||
setIcuDataDirectory();
|
||||
setupDagger();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -425,8 +431,8 @@ public class ZimContentProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private void setIcuDataDirectory() {
|
||||
File workingDir = this.getContext().getFilesDir();
|
||||
String icuDirPath = loadICUData(this.getContext(), workingDir);
|
||||
File workingDir = context.getFilesDir();
|
||||
String icuDirPath = loadICUData(context, workingDir);
|
||||
|
||||
if (icuDirPath != null) {
|
||||
Log.d(TAG_KIWIX, "Setting the ICU directory path to " + icuDirPath);
|
||||
@ -461,7 +467,7 @@ public class ZimContentProvider extends ContentProvider {
|
||||
JNIKiwixString mime = new JNIKiwixString();
|
||||
JNIKiwixInt size = new JNIKiwixInt();
|
||||
byte[] data = jniKiwix.getContent(articleZimUrl, mime, size);
|
||||
if (mime.value.equals("text/css") && KiwixMobileActivity.nightMode) {
|
||||
if (mime.value != null && mime.value.equals("text/css") && KiwixMobileActivity.nightMode) {
|
||||
out.write(("img { \n" +
|
||||
" -webkit-filter: invert(1); \n" +
|
||||
" filter: invert(1); \n" +
|
||||
|
@ -5,6 +5,8 @@ import dagger.Component;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.kiwix.kiwixmobile.KiwixMobileActivity;
|
||||
import org.kiwix.kiwixmobile.ZimContentProvider;
|
||||
import org.kiwix.kiwixmobile.di.modules.JNIModule;
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.ZimFileSelectFragment;
|
||||
import org.kiwix.kiwixmobile.bookmarks_view.BookmarksActivity;
|
||||
import org.kiwix.kiwixmobile.di.modules.ApplicationModule;
|
||||
@ -16,6 +18,7 @@ import org.kiwix.kiwixmobile.zim_manager.library_view.LibraryFragment;
|
||||
@Component(modules = {
|
||||
ApplicationModule.class,
|
||||
NetworkModule.class,
|
||||
JNIModule.class,
|
||||
})
|
||||
public interface ApplicationComponent {
|
||||
void inject(KiwixMobileActivity activity);
|
||||
@ -27,4 +30,6 @@ public interface ApplicationComponent {
|
||||
void inject(BookmarksActivity bookmarksActivity);
|
||||
|
||||
void inject(ZimFileSelectFragment zimFileSelectFragment);
|
||||
|
||||
void inject(ZimContentProvider zimContentProvider);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import javax.inject.Singleton;
|
||||
import org.kiwix.kiwixlib.JNIKiwix;
|
||||
import org.kiwix.kiwixmobile.KiwixApplication;
|
||||
|
||||
@Module public class ApplicationModule {
|
||||
|
@ -0,0 +1,20 @@
|
||||
package org.kiwix.kiwixmobile.di.modules;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import javax.inject.Singleton;
|
||||
import org.kiwix.kiwixlib.JNIKiwix;
|
||||
|
||||
/**
|
||||
* Created by mhutti1 on 14/04/17.
|
||||
*/
|
||||
|
||||
@Module public class JNIModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
public JNIKiwix providesJNIKiwix() {
|
||||
return new JNIKiwix();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -11,6 +11,7 @@ import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.TextView;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import org.kiwix.kiwixlib.JNIKiwix;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -27,6 +28,8 @@ public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filtera
|
||||
|
||||
private Context context;
|
||||
|
||||
@Inject JNIKiwix jniKiwix;
|
||||
|
||||
public AutoCompleteAdapter(Context context) {
|
||||
super(context, android.R.layout.simple_list_item_1);
|
||||
this.context = context;
|
||||
@ -84,7 +87,7 @@ public class AutoCompleteAdapter extends ArrayAdapter<String> implements Filtera
|
||||
/* Fulltex search */
|
||||
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (sharedPreferences.getBoolean(KiwixMobileActivity.PREF_FULL_TEXT_SEARCH, false)) {
|
||||
String[] results = JNIKiwix.indexedQuery(query, 200).split("\n");
|
||||
String[] results = jniKiwix.indexedQuery(query, 200).split("\n");
|
||||
for (String result : results) {
|
||||
if (!result.trim().isEmpty())
|
||||
data.add(result);
|
||||
|
@ -39,7 +39,7 @@ public class JNIKiwix {
|
||||
|
||||
public native boolean loadZIM(String path);
|
||||
|
||||
public native boolean loadFulltextIndex(String path);
|
||||
public native boolean loadFulltextIndex(String path);
|
||||
|
||||
public native byte[] getContent(String url, JNIKiwixString mimeType, JNIKiwixInt size);
|
||||
|
||||
@ -73,5 +73,5 @@ public class JNIKiwix {
|
||||
|
||||
public native void setDataDirectory(String icuDataDir);
|
||||
|
||||
public static native String indexedQuery(String db, int count);
|
||||
public native String indexedQuery(String db, int count);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user