53 lines
1.6 KiB
Java
53 lines
1.6 KiB
Java
|
package com.stevesoltys.backup.settings;
|
||
|
|
||
|
import android.os.Bundle;
|
||
|
import android.view.Menu;
|
||
|
import android.view.MenuInflater;
|
||
|
import android.view.MenuItem;
|
||
|
import android.widget.Toast;
|
||
|
|
||
|
import androidx.annotation.Nullable;
|
||
|
import androidx.appcompat.app.AppCompatActivity;
|
||
|
|
||
|
import com.stevesoltys.backup.R;
|
||
|
|
||
|
import static android.widget.Toast.LENGTH_SHORT;
|
||
|
import static java.util.Objects.requireNonNull;
|
||
|
|
||
|
public class SettingsActivity extends AppCompatActivity {
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
|
||
|
setContentView(R.layout.activity_settings);
|
||
|
|
||
|
requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||
|
MenuInflater inflater = getMenuInflater();
|
||
|
inflater.inflate(R.menu.settings_menu, menu);
|
||
|
if (getResources().getBoolean(R.bool.show_restore_in_settings)) {
|
||
|
menu.findItem(R.id.action_restore).setVisible(true);
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||
|
if (item.getItemId() == android.R.id.home) {
|
||
|
onBackPressed();
|
||
|
return true;
|
||
|
} else if (item.getItemId() == R.id.action_backup) {
|
||
|
Toast.makeText(this, "Not yet implemented", LENGTH_SHORT).show();
|
||
|
return true;
|
||
|
} else if (item.getItemId() == R.id.action_restore) {
|
||
|
Toast.makeText(this, "Not yet implemented", LENGTH_SHORT).show();
|
||
|
return true;
|
||
|
}
|
||
|
return super.onOptionsItemSelected(item);
|
||
|
}
|
||
|
}
|