Skip to content

Commit

Permalink
Remove permissions code
Browse files Browse the repository at this point in the history
  • Loading branch information
billthefarmer committed Feb 13, 2017
1 parent 80d0f99 commit 8a88940
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 44 deletions.
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ buildscript {
apply plugin: 'com.android.application'

android {
compileSdkVersion "android-25"
compileSdkVersion "android-17"
buildToolsVersion '24.0.2'

lintOptions {
disable 'IconDensities', 'ClickableViewAccessibility'
abortOnError false
}
}

dependencies {
compile 'com.android.support:support-compat:25.1.1'
}
3 changes: 2 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
android:installLocation="auto" >

<uses-sdk
tools:ignore="OldTargetApi"
android:minSdkVersion="11"
android:targetSdkVersion="25" />
android:targetSdkVersion="22" />

<uses-permission
android:name="android.permission.RECORD_AUDIO" />
Expand Down
34 changes: 4 additions & 30 deletions src/main/java/org/billthefarmer/tuner/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import android.media.AudioRecord;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActivityCompat;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -71,8 +70,6 @@ public class MainActivity extends Activity
private static final String PREF_COLOUR = "pref_colour";
private static final String PREF_CUSTOM = "pref_custom";

private static final int PERMISSIONS_REQUEST_RECORD_AUDIO = 1;

// Note values for display
private static final String notes[] =
{
Expand Down Expand Up @@ -367,15 +364,6 @@ void showToast(int key)
protected void onStart()
{
super.onStart();

if (ActivityCompat
.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
!= PackageManager.PERMISSION_GRANTED)
ActivityCompat
.requestPermissions(this,
new String[]
{Manifest.permission.RECORD_AUDIO},
PERMISSIONS_REQUEST_RECORD_AUDIO);
}

// On Resume
Expand All @@ -391,23 +379,8 @@ protected void onResume()
if (status != null)
status.invalidate();

if (ActivityCompat
.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
== PackageManager.PERMISSION_GRANTED)
// Start the audio thread
audio.start();
}

@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[],
int[] grantResults)
{
if (requestCode == PERMISSIONS_REQUEST_RECORD_AUDIO)

// Permission denied
if (grantResults[0] == PackageManager.PERMISSION_DENIED)
showToast(R.string.permission_denied);
// Start the audio thread
audio.start();
}

@Override
Expand Down Expand Up @@ -772,7 +745,8 @@ public void run()
Math.max(size, SIZE * divisor));
}

catch (IllegalArgumentException e)
// Exception
catch (Exception e)
{
runOnUiThread(new Runnable()
{
Expand Down
2 changes: 0 additions & 2 deletions src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
frecuencia de muestreo de entrada funcional.
</string>

<string name="permission_denied">Permiso denegado</string>

<string name="filter_on">Encender el filtro de audio</string>
<string name="filter_off">Apagar el filtro de audio</string>

Expand Down
2 changes: 0 additions & 2 deletions src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
frekvenciája.
</string>

<string name="permission_denied">hozzáférés megtagadva</string>

<string name="filter_on">Hangfrekvenciás szűrő be</string>
<string name="filter_off">Hangfrekvenciás szűrő ki</string>

Expand Down
2 changes: 0 additions & 2 deletions src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
オーディオレコーダーが初期化されていません! 選択された入力音源が利用できないか、動作中の入力サンプルレートが見つからない可能性があります。
</string>

<string name="permission_denied">アクセス拒否</string>

<string name="filter_on">オーディオフィルター オン</string>
<string name="filter_off">オーディオフィルター オフ</string>

Expand Down
2 changes: 0 additions & 2 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
not available, or a working input sample rate could not be found.
</string>

<string name="permission_denied">Permission denied</string>

<string name="filter_on">Audio filter on</string>
<string name="filter_off">Audio filter off</string>

Expand Down

0 comments on commit 8a88940

Please sign in to comment.