-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Oreo Issues Has Been Resolved. #30
base: master
Are you sure you want to change the base?
Changes from all commits
1c645f3
7857e40
b59f924
e1f647b
aa011ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.ahmedjazzar.rosetta.app; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.preference.PreferenceManager; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import com.ahmedjazzar.rosetta.ContextWrapper; | ||
|
||
import java.util.Locale; | ||
|
||
public abstract class BaseActivity extends AppCompatActivity { | ||
SharedPreferences mSharedPreferences; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
} | ||
|
||
@Override | ||
protected void attachBaseContext(Context newBase) { | ||
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(newBase); | ||
Locale locale = new Locale(mSharedPreferences.getString("user_preferred_language", "en")); | ||
Context context = ContextWrapper.wrap(newBase, locale); | ||
super.attachBaseContext(context); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
package com.ahmedjazzar.rosetta.app; | ||
|
||
import android.app.Application; | ||
import android.content.Context; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why all these unused imports? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zeeshanrasool91 Any updates on these? |
||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceManager; | ||
|
||
import com.ahmedjazzar.rosetta.ContextWrapper; | ||
import com.ahmedjazzar.rosetta.LanguageSwitcher; | ||
|
||
import java.util.HashSet; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:fitsSystemWindows="true" | ||
tools:context="com.ahmedjazzar.rosetta.app.MainActivity"> | ||
|
||
<android.support.design.widget.AppBarLayout | ||
<com.google.android.material.appbar.AppBarLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:theme="@style/AppTheme.AppBarOverlay"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
<androidx.appcompat.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="?attr/colorPrimary" | ||
app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||
|
||
</android.support.design.widget.AppBarLayout> | ||
</com.google.android.material.appbar.AppBarLayout> | ||
|
||
<include layout="@layout/content_main" /> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
<com.google.android.material.floatingactionbutton.FloatingActionButton | ||
android:id="@+id/fab" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_margin="@dimen/fab_margin" | ||
android:src="@drawable/ic_action_name" /> | ||
|
||
</android.support.design.widget.CoordinatorLayout> | ||
</androidx.coordinatorlayout.widget.CoordinatorLayout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
<item name="windowActionBar">false</item> | ||
<item name="windowNoTitle">true</item> | ||
<item name="android:windowDrawsSystemBarBackgrounds">true</item> | ||
<item name="android:statusBarColor">@android:color/transparent</item> | ||
<item name="android:statusBarColor">@color/colorPrimaryDark</item> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was actually showing me transparent view on my Lollipop device. |
||
</style> | ||
</resources> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
ext.kotlin_version = '1.3.71' | ||
repositories { | ||
jcenter() | ||
google() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:1.5.0' | ||
classpath 'com.android.tools.build:gradle:3.6.1' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
|
||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
|
@@ -15,6 +18,7 @@ buildscript { | |
allprojects { | ||
repositories { | ||
jcenter() | ||
google() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we using this repository? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is required by Latest Compat Libraries |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Oct 21 11:34:03 PDT 2015 | ||
#Mon Mar 30 15:47:02 GST 2020 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android-extensions' | ||
apply plugin: 'kotlin-android' | ||
|
||
ext { | ||
bintrayRepo = 'maven' | ||
|
@@ -14,7 +16,7 @@ ext { | |
siteUrl = 'https://github.com/ahmedaljazzar/rosetta' | ||
gitUrl = 'https://github.com/ahmedaljazzar/rosetta.git' | ||
|
||
libraryVersion = '1.0.1' | ||
libraryVersion = '1.0.2' | ||
|
||
developerId = 'ahmedaljazzar' | ||
developerName = 'Ahmed Jazzar' | ||
|
@@ -29,11 +31,12 @@ buildscript { | |
repositories { | ||
jcenter() | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' | ||
classpath 'com.android.tools.build:gradle:1.2.3' | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' | ||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' | ||
classpath 'com.android.tools.build:gradle:3.6.1' | ||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' | ||
} | ||
} | ||
|
||
|
@@ -45,12 +48,12 @@ android { | |
maven { url 'http://repo1.maven.org/maven2' } | ||
} | ||
|
||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
compileSdkVersion 29 | ||
buildToolsVersion '29.0.3' | ||
|
||
defaultConfig { | ||
minSdkVersion 14 | ||
targetSdkVersion 23 | ||
minSdkVersion 15 | ||
targetSdkVersion 29 | ||
versionCode 3 | ||
versionName "1.0.1" | ||
} | ||
|
@@ -64,11 +67,17 @@ android { | |
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
testCompile 'org.mockito:mockito-core:1.10.19' | ||
compile 'com.android.support:appcompat-v7:23.1.1' | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
testImplementation 'junit:junit:4.13' | ||
testImplementation 'org.mockito:mockito-core:2.23.0' | ||
implementation 'androidx.appcompat:appcompat:1.1.0' | ||
implementation 'com.jakewharton:process-phoenix:2.0.0' | ||
implementation "androidx.core:core-ktx:1.2.0" | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | ||
} | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' | ||
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' | ||
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to comment, just remove the line. |
||
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to comment as well, just remove the line. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.ahmedjazzar.rosetta"> | ||
|
||
<application android:supportsRtl="true" /> | ||
<application android:supportsRtl="true"/> | ||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.ahmedjazzar.rosetta; | ||
|
||
import android.content.Context; | ||
import android.content.res.Configuration; | ||
import android.content.res.Resources; | ||
import android.os.Build; | ||
import android.os.LocaleList; | ||
|
||
import java.util.Locale; | ||
|
||
public class ContextWrapper extends android.content.ContextWrapper { | ||
|
||
public ContextWrapper(Context base) { | ||
super(base); | ||
} | ||
|
||
public static ContextWrapper wrap(Context context, Locale newLocale) { | ||
|
||
Resources res = context.getResources(); | ||
Configuration configuration = res.getConfiguration(); | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { | ||
configuration.setLocale(newLocale); | ||
|
||
LocaleList localeList = new LocaleList(newLocale); | ||
LocaleList.setDefault(localeList); | ||
configuration.setLocales(localeList); | ||
|
||
context = context.createConfigurationContext(configuration); | ||
|
||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { | ||
configuration.setLocale(newLocale); | ||
context = context.createConfigurationContext(configuration); | ||
|
||
} else { | ||
configuration.locale = newLocale; | ||
res.updateConfiguration(configuration, res.getDisplayMetrics()); | ||
} | ||
|
||
return new ContextWrapper(context); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this method if it doesn't contain changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeeshanrasool91 Any updates ion this?