mirror of
https://github.com/woheller69/solxpect.git
synced 2026-02-06 16:21:48 +01:00
add help activity
This commit is contained in:
parent
4a81cd5c1f
commit
36a3e02c52
11 changed files with 211 additions and 2 deletions
|
|
@ -0,0 +1,44 @@
|
|||
package org.woheller69.weather.activities;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebView;
|
||||
import org.woheller69.weather.R;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class HelpActivity extends NavigationActivity{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_help);
|
||||
WebView view = findViewById(R.id.help);
|
||||
|
||||
String language = getResources().getConfiguration().getLocales().get(0).getLanguage();
|
||||
|
||||
String filename = "help-"+language+".html";
|
||||
|
||||
AssetManager am = getAssets();
|
||||
try {
|
||||
List<String> mapList = Arrays.asList(am.list("help"));
|
||||
|
||||
if (!mapList.contains(filename)) {
|
||||
filename = "help-en.html";
|
||||
}
|
||||
} catch ( IOException ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
view.loadUrl("file:///android_asset/help/"+ filename);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -174,10 +174,13 @@ public class NavigationActivity extends AppCompatActivity implements OnNavigatio
|
|||
startActivity(intent);
|
||||
}else if (itemId==R.id.nav_about) {
|
||||
intent = new Intent(this, AboutActivity.class);
|
||||
createBackStack(intent);
|
||||
startActivity(intent);
|
||||
}else if(itemId==R.id.nav_settings) {
|
||||
intent = new Intent(this, SettingsActivity.class);
|
||||
createBackStack(intent);
|
||||
startActivity(intent);
|
||||
}else if(itemId==R.id.nav_help) {
|
||||
intent = new Intent(this, HelpActivity.class);
|
||||
startActivity(intent);
|
||||
}else if (itemId==R.id.star_on_github){
|
||||
startActivity(new Intent(Intent.ACTION_VIEW,
|
||||
Uri.parse(BuildConfig.GITHUB_URL)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue