mirror of
https://gitlab.com/openlp/android.git
synced 2024-12-22 03:42:48 +00:00
Add singletons and fix views
This commit is contained in:
parent
701a889df2
commit
39cb07860d
17
app/app.iml
17
app/app.iml
@ -66,14 +66,6 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||||
@ -82,10 +74,17 @@
|
|||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
|
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
|
||||||
|
@ -35,6 +35,8 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
import org.openlp.android2.activities.SettingsActivity;
|
import org.openlp.android2.activities.SettingsActivity;
|
||||||
import org.openlp.android2.common.NavigationOptions;
|
import org.openlp.android2.common.NavigationOptions;
|
||||||
|
import org.openlp.android2.common.OpenLPURLBuilder;
|
||||||
|
import org.openlp.android2.common.StateHolder;
|
||||||
import org.openlp.android2.dialogs.AlertDisplayDialog;
|
import org.openlp.android2.dialogs.AlertDisplayDialog;
|
||||||
import org.openlp.android2.dialogs.BlankDisplayDialog;
|
import org.openlp.android2.dialogs.BlankDisplayDialog;
|
||||||
import org.openlp.android2.fragments.AboutFragment;
|
import org.openlp.android2.fragments.AboutFragment;
|
||||||
@ -65,6 +67,8 @@ public class OpenLP extends ActionBarActivity
|
|||||||
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);
|
||||||
|
OpenLPURLBuilder.getInstance().setContext(this);
|
||||||
|
StateHolder.getInstance().setContext(this);
|
||||||
|
|
||||||
doPreferenceCheck();
|
doPreferenceCheck();
|
||||||
|
|
||||||
|
@ -30,7 +30,16 @@ public class OpenLPURLBuilder {
|
|||||||
private final String LOG_TAG = OpenLPURLBuilder.class.getName();
|
private final String LOG_TAG = OpenLPURLBuilder.class.getName();
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
public OpenLPURLBuilder(Context context) {
|
private static OpenLPURLBuilder ourInstance = new OpenLPURLBuilder();
|
||||||
|
|
||||||
|
public static OpenLPURLBuilder getInstance() {
|
||||||
|
return ourInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpenLPURLBuilder() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,10 @@ public class RequestQueueService {
|
|||||||
private RequestQueue mRequestQueue;
|
private RequestQueue mRequestQueue;
|
||||||
private ImageLoader mImageLoader;
|
private ImageLoader mImageLoader;
|
||||||
private static Context mCtx;
|
private static Context mCtx;
|
||||||
private OpenLPURLBuilder urlbuilder;
|
|
||||||
|
|
||||||
private RequestQueueService(Context context) {
|
private RequestQueueService(Context context) {
|
||||||
mCtx = context;
|
mCtx = context;
|
||||||
mRequestQueue = getRequestQueue();
|
mRequestQueue = getRequestQueue();
|
||||||
urlbuilder = new OpenLPURLBuilder(context);
|
|
||||||
|
|
||||||
mImageLoader = new ImageLoader(mRequestQueue,
|
mImageLoader = new ImageLoader(mRequestQueue,
|
||||||
new ImageLoader.ImageCache() {
|
new ImageLoader.ImageCache() {
|
||||||
@ -79,15 +77,15 @@ public class RequestQueueService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getUrl(String url){
|
public String getUrl(String url){
|
||||||
return String.format("%s%s", urlbuilder.getBaseUrl(), url );
|
return String.format("%s%s", OpenLPURLBuilder.getInstance().getBaseUrl(), url );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBasicAuth(){
|
public String getBasicAuth(){
|
||||||
return urlbuilder.getBasicAuth();
|
return OpenLPURLBuilder.getInstance().getBasicAuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getConnectionTimeout(){
|
public int getConnectionTimeout(){
|
||||||
return urlbuilder.getConnectionTimeout();
|
return OpenLPURLBuilder.getInstance().getConnectionTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> void addToRequestQueue(Request<T> req) {
|
public <T> void addToRequestQueue(Request<T> req) {
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package org.openlp.android2.common;
|
package org.openlp.android2.common;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by tim on 14/08/16.
|
* Created by tim on 14/08/16.
|
||||||
*/
|
*/
|
||||||
public class StateHolder {
|
public class StateHolder {
|
||||||
private static StateHolder ourInstance = new StateHolder();
|
private static StateHolder ourInstance = new StateHolder();
|
||||||
|
private static Context context;
|
||||||
|
|
||||||
public static StateHolder getInstance() {
|
public static StateHolder getInstance() {
|
||||||
return ourInstance;
|
return ourInstance;
|
||||||
@ -12,4 +15,8 @@ public class StateHolder {
|
|||||||
|
|
||||||
private StateHolder() {
|
private StateHolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContext(Context context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public class SearchFragment extends Fragment {
|
|||||||
|
|
||||||
public void populateListDisplay(String json, boolean notInError) {
|
public void populateListDisplay(String json, boolean notInError) {
|
||||||
Log.i(LOG_TAG, "populateListDisplay - entry");
|
Log.i(LOG_TAG, "populateListDisplay - entry");
|
||||||
ListView list = (ListView) getActivity().findViewById(R.id.searchlistView);
|
ListView list = (ListView) getActivity().findViewById(R.id.searchListView);
|
||||||
final ArrayList<JSONArray> listitems = new ArrayList<JSONArray>();
|
final ArrayList<JSONArray> listitems = new ArrayList<JSONArray>();
|
||||||
if (notInError) {
|
if (notInError) {
|
||||||
try {
|
try {
|
||||||
|
@ -26,6 +26,7 @@ import android.view.ViewGroup;
|
|||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import org.openlp.android2.R;
|
import org.openlp.android2.R;
|
||||||
|
import org.openlp.android2.common.OpenLPURLBuilder;
|
||||||
|
|
||||||
public class WebFragment extends Fragment {
|
public class WebFragment extends Fragment {
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ public class WebFragment extends Fragment {
|
|||||||
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
|
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
|
||||||
webview.setScrollbarFadingEnabled(true);
|
webview.setScrollbarFadingEnabled(true);
|
||||||
webview.setWebViewClient(new webClient());
|
webview.setWebViewClient(new webClient());
|
||||||
//webview.loadUrl(String.format("%s%s", httpClient.getBaseUrl(), curURL));
|
webview.loadUrl(String.format("%s%s", OpenLPURLBuilder.getInstance().getBaseUrl(), curURL));
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,6 @@
|
|||||||
android:right="10dp"
|
android:right="10dp"
|
||||||
android:top="10dp"
|
android:top="10dp"
|
||||||
android:bottom="10dp"/>
|
android:bottom="10dp"/>
|
||||||
<solid android:color="#c4c4c4"/>
|
<solid android:color="#FFF"/>
|
||||||
<stroke android:width="2px" android:color="#ffffff"/>
|
<stroke android:width="2px" android:color="#ffffff"/>
|
||||||
</shape>
|
</shape>
|
@ -9,7 +9,7 @@
|
|||||||
android:smoothScrollbar="true"
|
android:smoothScrollbar="true"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:longClickable="false"
|
android:longClickable="false"
|
||||||
android:background="@drawable/customborder">
|
android:background="@drawable/custom_border">
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tag"
|
android:id="@+id/tag"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
android:smoothScrollbar="true"
|
android:smoothScrollbar="true"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:longClickable="false"
|
android:longClickable="false"
|
||||||
android:background="@drawable/customborder">
|
android:background="@drawable/custom_border">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tag"
|
android:id="@+id/tag"
|
||||||
|
@ -63,13 +63,13 @@
|
|||||||
<ListView
|
<ListView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:id="@+id/searchlistView"
|
android:id="@+id/searchListView"
|
||||||
android:paddingLeft="30dp"
|
android:paddingLeft="30dp"
|
||||||
android:paddingRight="30dp"
|
android:paddingRight="30dp"
|
||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:height="70dp"
|
android:height="70dp"
|
||||||
android:layout_weight="0.8"
|
android:layout_weight="0.8"
|
||||||
android:background="@drawable/searchlist"/>
|
android:background="@drawable/search_list"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
android:smoothScrollbar="true"
|
android:smoothScrollbar="true"
|
||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:longClickable="false"
|
android:longClickable="false"
|
||||||
android:background="@drawable/customborder">
|
android:background="@drawable/custom_border">
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
Loading…
Reference in New Issue
Block a user