Add debug activity

This commit is contained in:
xynngh 2019-06-09 18:23:20 +04:00
parent 6c333a0f99
commit 19f640c528
8 changed files with 70 additions and 19 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="dummydomain.yetanothercallblocker">
<uses-permission android:name="android.permission.INTERNET" />
@ -13,18 +14,22 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".DummyActivity">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DebugActivity"
android:label="@string/debug_activity_label" />
<activity
android:name=".ReviewsActivity"
android:label="@string/title_activity_reviews"
android:theme="@style/AppTheme.NoActionBar"/>
android:theme="@style/AppTheme.NoActionBar" />
<receiver
android:name=".CallReceiver"

View File

@ -1,7 +1,6 @@
package dummydomain.yetanothercallblocker;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
@ -12,27 +11,17 @@ import dummydomain.yetanothercallblocker.sia.DatabaseSingleton;
import dummydomain.yetanothercallblocker.sia.model.database.CommunityDatabaseItem;
import dummydomain.yetanothercallblocker.sia.model.database.FeaturedDatabaseItem;
public class DummyActivity extends AppCompatActivity {
public class DebugActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dummy);
PermissionHelper.checkPermissions(this);
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// TODO: handle
setContentView(R.layout.activity_debug);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_dummy, menu);
getMenuInflater().inflate(R.menu.activity_debug, menu);
return true;
}
@ -71,7 +60,7 @@ public class DummyActivity extends AppCompatActivity {
@Override
protected void onPostExecute(Void aVoid) {
Toast.makeText(DummyActivity.this, "Update finished; DB ver: "
Toast.makeText(DebugActivity.this, "Update finished; DB ver: "
+ DatabaseSingleton.getCommunityDatabase().getEffectiveDbVersion(),
Toast.LENGTH_SHORT).show();
}

View File

@ -0,0 +1,38 @@
package dummydomain.yetanothercallblocker;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PermissionHelper.checkPermissions(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// TODO: handle
}
public void onOpenDebugActivity(MenuItem item) {
startActivity(new Intent(this, DebugActivity.class));
}
}

View File

@ -4,6 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DummyActivity">
tools:context=".DebugActivity">
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">
</android.support.constraint.ConstraintLayout>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:onClick="onOpenDebugActivity"
android:title="@string/open_debug_activity" />
</menu>

View File

@ -40,5 +40,7 @@
<string name="sia_category_safe_nonprofit">Safe nonprofit</string>
<string name="title_activity_reviews">Reviews</string>
<string name="open_debug_activity">Open debug screen</string>
<string name="debug_activity_label">Debug</string>
</resources>