mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #450 from veyndan/activity
Extend from AppCompatActivity instead of Activity
This commit is contained in:
commit
bcda4474b9
9 changed files with 16 additions and 50 deletions
|
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".auth.LoginActivity"
|
android:name=".auth.LoginActivity"
|
||||||
android:theme="@style/NoTitle" >
|
>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".WelcomeActivity"
|
android:name=".WelcomeActivity"
|
||||||
android:theme="@style/NoTitle" >
|
>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".upload.ShareActivity"
|
android:name=".upload.ShareActivity"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ public class AboutActivity extends BaseActivity {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
|
|
||||||
|
getSupportActionBar().hide();
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
|
|
||||||
uploadsToText.setText(CommonsApplication.EVENTLOG_WIKI);
|
uploadsToText.setText(CommonsApplication.EVENTLOG_WIKI);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ public class WelcomeActivity extends BaseActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_welcome);
|
setContentView(R.layout.activity_welcome);
|
||||||
|
|
||||||
|
getSupportActionBar().hide();
|
||||||
|
|
||||||
pager = (ViewPager)findViewById(R.id.welcomePager);
|
pager = (ViewPager)findViewById(R.id.welcomePager);
|
||||||
pager.setAdapter(new PagerAdapter() {
|
pager.setAdapter(new PagerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ import android.os.Bundle;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
|
import fr.free.nrw.commons.theme.BaseActivity;
|
||||||
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 BaseAppCompatActivity {
|
public abstract class AuthenticatedActivity extends BaseActivity {
|
||||||
|
|
||||||
String accountType;
|
String accountType;
|
||||||
CommonsApplication app;
|
CommonsApplication app;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ public class SignupActivity extends BaseActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Log.d("SignupActivity", "Signup Activity started");
|
Log.d("SignupActivity", "Signup Activity started");
|
||||||
|
|
||||||
|
getSupportActionBar().hide();
|
||||||
|
|
||||||
webView = new WebView(this);
|
webView = new WebView(this);
|
||||||
setContentView(webView);
|
setContentView(webView);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
import fr.free.nrw.commons.theme.BaseAppCompatActivity;
|
import fr.free.nrw.commons.theme.BaseActivity;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
public class NearbyActivity extends BaseAppCompatActivity {
|
public class NearbyActivity extends BaseActivity {
|
||||||
|
|
||||||
private MyLocationListener myLocationListener;
|
private MyLocationListener myLocationListener;
|
||||||
private LocationManager locationManager;
|
private LocationManager locationManager;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,13 @@
|
||||||
package fr.free.nrw.commons.theme;
|
package fr.free.nrw.commons.theme;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
||||||
|
public class BaseActivity extends AppCompatActivity {
|
||||||
public class BaseActivity extends Activity {
|
|
||||||
boolean currentTheme;
|
boolean currentTheme;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -27,7 +26,7 @@ public class BaseActivity extends Activity {
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
// Restart activity if theme is changed
|
// Restart activity if theme is changed
|
||||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true);
|
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true);
|
||||||
if(currentTheme!=newTheme){ // is activity theme changed
|
if(currentTheme!=newTheme){ //is activity theme changed
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
finish();
|
finish();
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
package fr.free.nrw.commons.theme;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
|
||||||
|
|
||||||
public class BaseAppCompatActivity extends AppCompatActivity {
|
|
||||||
boolean currentTheme;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true)) {
|
|
||||||
currentTheme = true;
|
|
||||||
setTheme(R.style.DarkAppTheme);
|
|
||||||
}else {
|
|
||||||
currentTheme = false;
|
|
||||||
setTheme(R.style.LightAppTheme); // default
|
|
||||||
}
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
// Restart activity if theme is changed
|
|
||||||
boolean newTheme = PreferenceManager.getDefaultSharedPreferences(this).getBoolean("theme",true);
|
|
||||||
if(currentTheme!=newTheme){ //is activity theme changed
|
|
||||||
Intent intent = getIntent();
|
|
||||||
finish();
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -43,10 +43,6 @@
|
||||||
<item name="colorControlNormal">#ffffff</item>
|
<item name="colorControlNormal">#ffffff</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="NoTitle" parent="DarkAppTheme">
|
|
||||||
<item name="android:windowNoTitle">true</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal" />
|
<style name="ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue