mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Add BaseActivity and BaseAppcompatActivity
This commit is contained in:
parent
639908a716
commit
5147769405
8 changed files with 70 additions and 11 deletions
|
|
@ -1,12 +1,11 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class AboutActivity extends Activity {
|
public class AboutActivity extends BaseActivity {
|
||||||
private TextView versionText;
|
private TextView versionText;
|
||||||
private TextView licenseText;
|
private TextView licenseText;
|
||||||
private TextView improveText;
|
private TextView improveText;
|
||||||
|
|
|
||||||
19
app/src/main/java/fr/free/nrw/commons/BaseActivity.java
Normal file
19
app/src/main/java/fr/free/nrw/commons/BaseActivity.java
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
|
||||||
|
public class BaseActivity extends Activity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
//Check prefs on every activity starts
|
||||||
|
if (getSharedPreferences("prefs", Context.MODE_PRIVATE).getBoolean("theme", false)) {
|
||||||
|
setTheme(R.style.LightAppTheme);
|
||||||
|
}else {
|
||||||
|
setTheme(R.style.DarkAppTheme); //default
|
||||||
|
}
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
|
public class BaseAppCompatActivity extends AppCompatActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
//Check prefs on every activity starts
|
||||||
|
if (getSharedPreferences("prefs", Context.MODE_PRIVATE).getBoolean("theme", false)) {
|
||||||
|
setTheme(R.style.LightAppTheme);
|
||||||
|
}else {
|
||||||
|
setTheme(R.style.DarkAppTheme); //default
|
||||||
|
}
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.free.nrw.commons;
|
package fr.free.nrw.commons;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
|
@ -10,7 +9,7 @@ import android.widget.Button;
|
||||||
|
|
||||||
import com.viewpagerindicator.CirclePageIndicator;
|
import com.viewpagerindicator.CirclePageIndicator;
|
||||||
|
|
||||||
public class WelcomeActivity extends Activity {
|
public class WelcomeActivity extends BaseActivity {
|
||||||
static final int PAGE_WIKIPEDIA = 0,
|
static final int PAGE_WIKIPEDIA = 0,
|
||||||
PAGE_DO_UPLOAD = 1,
|
PAGE_DO_UPLOAD = 1,
|
||||||
PAGE_DONT_UPLOAD = 2,
|
PAGE_DONT_UPLOAD = 2,
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,11 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.BaseAppCompatActivity;
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.Utils;
|
import fr.free.nrw.commons.Utils;
|
||||||
|
|
||||||
public abstract class AuthenticatedActivity extends AppCompatActivity {
|
public abstract class AuthenticatedActivity extends BaseAppCompatActivity {
|
||||||
|
|
||||||
String accountType;
|
String accountType;
|
||||||
CommonsApplication app;
|
CommonsApplication app;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.free.nrw.commons.auth;
|
package fr.free.nrw.commons.auth;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -9,7 +8,9 @@ import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class SignupActivity extends Activity {
|
import fr.free.nrw.commons.BaseActivity;
|
||||||
|
|
||||||
|
public class SignupActivity extends BaseActivity {
|
||||||
|
|
||||||
private WebView webView;
|
private WebView webView;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@ import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.BaseAppCompatActivity;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
public class NearbyActivity extends AppCompatActivity {
|
public class NearbyActivity extends BaseAppCompatActivity {
|
||||||
|
|
||||||
private MyLocationListener myLocationListener;
|
private MyLocationListener myLocationListener;
|
||||||
private LocationManager locationManager;
|
private LocationManager locationManager;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,29 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat" />
|
<style name="DarkAppTheme" parent="Theme.AppCompat">
|
||||||
|
<item name="mainBackground">@color/main_background_dark</item>
|
||||||
|
<item name="semitransparentText">@color/commons_app_blue_dark</item>
|
||||||
|
<item name="commonsAppBlue">@color/activity_welcome_background_dark</item>
|
||||||
|
<item name="subBackground">@color/sub_background_dark</item>
|
||||||
|
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_dark</item>
|
||||||
|
<item name="buttonBackground">@color/button_background_dark</item>
|
||||||
|
<item name="uploadOverlayBackground">@color/upload_overlay_background_dark</item>
|
||||||
|
<item name="toggleButtonIcon">@drawable/toggle_inverse</item>
|
||||||
|
|
||||||
<style name="NoTitle" parent="AppTheme">
|
</style>
|
||||||
|
|
||||||
|
<style name="LightAppTheme" parent="Theme.AppCompat.Light">
|
||||||
|
<item name="mainBackground">@color/main_background_light</item>
|
||||||
|
<item name="semitransparentText">@color/commons_app_blue_light</item>
|
||||||
|
<item name="commonsAppBlue">@color/activity_welcome_background_light</item>
|
||||||
|
<item name="subBackground">@color/sub_background_light</item>
|
||||||
|
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_light</item>
|
||||||
|
<item name="buttonBackground">@color/button_background_light</item>
|
||||||
|
<item name="uploadOverlayBackground">@color/upload_overlay_background_light</item>
|
||||||
|
<item name="toggleButtonIcon">@drawable/toggle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NoTitle" parent="DarkAppTheme">
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue