drop "shop" drawer item

This commit is contained in:
Vincent Breitmoser
2020-09-05 14:22:42 +02:00
parent 197afe37cc
commit aa6ff03545
14 changed files with 9 additions and 164 deletions

View File

@@ -55,7 +55,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
public static final int ID_TRANSFER = 5;
static final int ID_SETTINGS = 6;
static final int ID_HELP = 7;
static final int ID_SHOP = 8;
// both of these are used for instrumentation testing only
public static final String EXTRA_SKIP_FIRST_TIME = "skip_first_time";
@@ -78,8 +77,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
.withHeader(R.layout.main_drawer_header)
.withToolbar(mToolbar)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.nav_shop).withIcon(CommunityMaterial.Icon.cmd_shopping)
.withIdentifier(ID_SHOP).withSelectable(false).withTypeface(Typeface.DEFAULT_BOLD),
new PrimaryDrawerItem().withName(R.string.nav_keys).withIcon(CommunityMaterial.Icon.cmd_key)
.withIdentifier(ID_KEYS).withSelectable(false),
new PrimaryDrawerItem().withName(R.string.nav_encrypt_decrypt).withIcon(FontAwesome.Icon.faw_lock)
@@ -125,9 +122,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
case ID_HELP:
intent = new Intent(MainActivity.this, HelpActivity.class);
break;
case ID_SHOP:
onShopSelected();
break;
}
if (intent != null) {
MainActivity.this.startActivity(intent);
@@ -252,13 +246,6 @@ public class MainActivity extends BaseSecurityTokenActivity implements FabContai
}
}
private void onShopSelected() {
mToolbar.setTitle(R.string.shop_title);
mDrawer.setSelection(ID_SHOP, false);
Fragment frag = new SecurityKeyShopFragment();
setFragment(frag);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
// add the values which need to be saved from the drawer to the bundle

View File

@@ -1,77 +0,0 @@
/*
* Copyright (C) 2017 Schürmann & Breitmoser GbR
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.sufficientlysecure.keychain.ui;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.sufficientlysecure.keychain.R;
import java.util.HashMap;
import java.util.Map;
public class SecurityKeyShopFragment extends Fragment {
public static final String webShopURL = "https://shop.cotech.de/";
public static final String referer = "https://openkeychain.shop.cotech.de";
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.security_key_shop_fragment, container, false);
WebView webView = view.findViewById(R.id.shop_webView);
webView.setWebViewClient(new SecurityKeyShopWebViewClient(
view.findViewById(R.id.shop_progressbar),
view.findViewById(R.id.shop_progressbar_label)
));
webView.getSettings().setJavaScriptEnabled(true);
Map<String, String> headers = new HashMap<>();
headers.put("Referer", referer);
webView.loadUrl(webShopURL, headers);
return view;
}
class SecurityKeyShopWebViewClient extends WebViewClient {
private ProgressBar progressBar;
private TextView progressBarLabel;
SecurityKeyShopWebViewClient(ProgressBar progressBar, TextView progressBarLabel) {
this.progressBar = progressBar;
this.progressBarLabel = progressBarLabel;
progressBar.setVisibility(View.VISIBLE);
progressBarLabel.setVisibility(View.VISIBLE);
}
@Override
public void onPageCommitVisible(WebView view, String url) {
super.onPageCommitVisible(view, url);
progressBar.setVisibility(View.GONE);
progressBarLabel.setVisibility(View.GONE);
}
}
}