添加调试接口

This commit is contained in:
2026-04-24 17:01:25 +08:00
parent 21140fb22b
commit 5de2263307
3 changed files with 12 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
@@ -208,6 +209,10 @@ public class MainActivity extends AppCompatActivity {
loadAlbums(); loadAlbums();
} }
return true; return true;
} else if (id == R.id.action_debug) {
Log.d("Gallery", "Debug log message");
Toast.makeText(this, R.string.debug_message, Toast.LENGTH_SHORT).show();
return true;
} }
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

View File

@@ -17,4 +17,9 @@
android:title="@string/refresh" android:title="@string/refresh"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/action_debug"
android:title="@string/debug_log"
app:showAsAction="never"/>
</menu> </menu>

View File

@@ -14,4 +14,6 @@
<string name="restore_confirm">Restore to original folder?</string> <string name="restore_confirm">Restore to original folder?</string>
<string name="yes">Yes</string> <string name="yes">Yes</string>
<string name="no">No</string> <string name="no">No</string>
<string name="debug_log">Debug Log</string>
<string name="debug_message">Debug log message</string>
</resources> </resources>