-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*Update Build Tools and SDK to v26.0.2. *Version bump to v1.2.
- Loading branch information
1 parent
c393547
commit 5585572
Showing
4 changed files
with
382 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.3" | ||
defaultConfig { | ||
applicationId "stream.custompermissionsapp" | ||
minSdkVersion 16 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
vectorDrawables.useSupportLibrary = true | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { url 'https://jitpack.io' } | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
compile project(path: ':custompermissionsdialogue') | ||
|
||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
compile 'com.android.support:design:25.3.1' | ||
compile 'com.android.support:support-vector-drawable:25.3.1' | ||
} | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
buildToolsVersion "26.0.2" | ||
defaultConfig { | ||
applicationId "stream.custompermissionsapp" | ||
minSdkVersion 15 | ||
targetSdkVersion 26 | ||
versionCode 1 | ||
versionName "1.0" | ||
vectorDrawables.useSupportLibrary = true | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { url 'https://jitpack.io' } | ||
} | ||
|
||
dependencies { | ||
repositories { | ||
maven { url "https://maven.google.com" } | ||
} | ||
|
||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
compile project(path: ':custompermissionsdialogue') | ||
|
||
compile 'com.android.support:appcompat-v7:26.0.2' | ||
compile 'com.android.support:design:26.0.2' | ||
compile 'com.android.support:support-vector-drawable:26.0.2' | ||
} |
191 changes: 94 additions & 97 deletions
191
app/src/main/java/stream/custompermissionsapp/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,94 @@ | ||
package stream.custompermissionsapp; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
import java.lang.ref.WeakReference; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private static WeakReference<Activity> mActivityRef; | ||
public final String mActivity = "IntroActivity"; | ||
|
||
private Fragment fragment; | ||
private Context mContext; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
super.onCreate(savedInstanceState); | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
setContentView(R.layout.activity_intro); | ||
mContext = getApplicationContext(); | ||
mActivityRef = new WeakReference<Activity>(this); | ||
|
||
if (savedInstanceState != null) { | ||
|
||
fragment = getSupportFragmentManager().getFragment(savedInstanceState, "currentFragment"); | ||
|
||
} else { | ||
|
||
fragment = new PermissionsFragment(); | ||
} | ||
|
||
FragmentManager fragmentManager = getSupportFragmentManager(); | ||
fragmentManager.beginTransaction().replace(R.id.fragmentcontainer, fragment, "currentFragment").commit(); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { | ||
//Removes flickering from setting window fullscreen | ||
Handler handler = new Handler(); | ||
handler.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
}); | ||
} | ||
super.onPause(); | ||
} | ||
|
||
@Override | ||
protected void onSaveInstanceState(Bundle outState) { | ||
|
||
super.onSaveInstanceState(outState); | ||
if (getSupportFragmentManager().findFragmentByTag("currentFragment") != null) | ||
{ | ||
fragment = getSupportFragmentManager().findFragmentByTag("currentFragment"); | ||
getSupportFragmentManager().putFragment(outState, "currentFragment", fragment); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
} | ||
|
||
@Override | ||
public void onWindowFocusChanged(boolean hasFocus) { | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { | ||
if (hasFocus) { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
} | ||
super.onWindowFocusChanged(hasFocus); | ||
} | ||
} | ||
package stream.custompermissionsapp; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.view.Window; | ||
|
||
import java.lang.ref.WeakReference; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private Fragment fragment; | ||
private Context mContext; | ||
public final String mActivity = "MainActivity"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
super.onCreate(savedInstanceState); | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
setContentView(R.layout.activity_intro); | ||
mContext = getApplicationContext(); | ||
|
||
if (savedInstanceState != null) { | ||
|
||
fragment = getSupportFragmentManager().getFragment(savedInstanceState, "currentFragment"); | ||
|
||
} else { | ||
|
||
fragment = new PermissionsFragment(); | ||
} | ||
|
||
FragmentManager fragmentManager = getSupportFragmentManager(); | ||
fragmentManager.beginTransaction().replace(R.id.fragmentcontainer, fragment, "currentFragment").commit(); | ||
} | ||
|
||
@Override | ||
protected void onPause() { | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { | ||
//Removes flickering from setting window fullscreen | ||
Handler handler = new Handler(); | ||
handler.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
}); | ||
} | ||
super.onPause(); | ||
} | ||
|
||
@Override | ||
protected void onSaveInstanceState(Bundle outState) { | ||
|
||
super.onSaveInstanceState(outState); | ||
if (getSupportFragmentManager().findFragmentByTag("currentFragment") != null) | ||
{ | ||
fragment = getSupportFragmentManager().findFragmentByTag("currentFragment"); | ||
getSupportFragmentManager().putFragment(outState, "currentFragment", fragment); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onResume() { | ||
super.onResume(); | ||
} | ||
|
||
@Override | ||
public void onWindowFocusChanged(boolean hasFocus) { | ||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { | ||
if (hasFocus) { | ||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_FULLSCREEN | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); | ||
} | ||
} | ||
super.onWindowFocusChanged(hasFocus); | ||
} | ||
} |
Oops, something went wrong.