Skip to content

Commit

Permalink
Merge pull request #9691 from brave/maxk-gitattributes-1.28.x
Browse files Browse the repository at this point in the history
Added .gitattbutes (1.28.x).
  • Loading branch information
kjozwiak authored Aug 9, 2021
2 parents 9d6d7bd + 6534f97 commit c1c47c9
Show file tree
Hide file tree
Showing 168 changed files with 37,124 additions and 37,069 deletions.
56 changes: 56 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Force LF checkout for all source files
*.bin binary
*.c text eol=lf
*.cc text eol=lf
*.cpp text eol=lf
*.css text eol=lf
*.csv text eol=lf
*.grd text eol=lf
*.grdp text eol=lf
*.gn text eol=lf
*.gni text eol=lf
*.h text eol=lf
*.html text eol=lf
*.icon text eol=lf
*.idl text eol=lf
*.in text eol=lf
*.inc text eol=lf
*.java text eol=lf
*.js text eol=lf
*.json text eol=lf
*.json5 text eol=lf
*.md text eol=lf
*.mm text eol=lf
*.mojom text eol=lf
*.patch text eol=lf
*.pdf -diff
*.proto text eol=lf
*.py text eol=lf
*.sh text eol=lf
*.sql text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.xslt text eol=lf
*.xtb text eol=lf

.clang-format text eol=lf
.eslintrc.js text eol=lf
.git-blame-ignore-revs text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
.vpython text eol=lf

DEPS text eol=lf
LICENSE text eol=lf
LICENSE.* text eol=lf
OWNERS text eol=lf
README text eol=lf
README.* text eol=lf
VERSION text eol=lf

# These files should have CRLF
win_build_output/midl/google_update/*/*.c text eol=crlf
win_build_output/midl/google_update/*/*.h text eol=crlf
test/data/tor/tor_control/*_win/controlport text eol=crlf
Original file line number Diff line number Diff line change
@@ -1,140 +1,131 @@
/** Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.chromium.chrome.browser;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;

import org.chromium.chrome.R;
import org.chromium.chrome.browser.BraveRewardsBalance;
import org.chromium.chrome.browser.BraveRewardsExternalWallet;
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.init.AsyncInitializationActivity;

public class BraveRewardsUserWalletActivity extends AsyncInitializationActivity {
public static final String DISCONNECT_WALLET_URL = "chrome://rewards/#disconnect-wallet";

@Override
protected void triggerLayoutInflation() {
setContentView(R.layout.user_wallet_activity);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowTitleEnabled(false);

SetUIControls();

onInitialLayoutInflationComplete();
}

private void SetUIControls() {
Intent intent = getIntent();
final int status = intent.getIntExtra(
BraveRewardsExternalWallet.STATUS, -1);
TextView txtUserId = (TextView)findViewById(R.id.user_id);
TextView txtUserStatus = (TextView)findViewById(R.id.user_status);
Button btn1 = (Button)findViewById(R.id.user_wallet_btn1);
Button btn2 = null;
Button btnGotoUphold = (Button)findViewById(
R.id.user_wallet_go_to_uphold);

if (status < BraveRewardsExternalWallet.NOT_CONNECTED ||
status > BraveRewardsExternalWallet.PENDING) {
finish();
}
else if (status == BraveRewardsExternalWallet.VERIFIED){
//set 2nd button visible
findViewById(R.id.user_wallet_btn2_separator).setVisibility(
View.VISIBLE);
btn2 = (Button)findViewById(R.id.user_wallet_btn2);
btn2.setVisibility(View.VISIBLE);

//Buttons:
//Add funds
//Withdraw
//Go to uphold
//Disconnect
btn1.setText(getResources().getString(
R.string.brave_rewards_local_panel_add_funds));
btn2.setText(getResources().getString(
R.string.user_wallet_withdraw_funds));
txtUserStatus.setText(
BraveRewardsExternalWallet.WalletStatusToString(status));

SetBtnOpenUrlClickHandler(btn1,
intent.getStringExtra(BraveRewardsExternalWallet.ADD_URL));
SetBtnOpenUrlClickHandler(btn2,
intent.getStringExtra(BraveRewardsExternalWallet.WITHDRAW_URL));
}
else {
//CONNECTED or PENDING
//Buttons:
//Complete verification
//Go to uphold
//Disconnect
btn1.setText(getResources().getString(
R.string.user_wallet_complete_verification));
SetBtnOpenUrlClickHandler(btn1,
intent.getStringExtra(BraveRewardsExternalWallet.VERIFY_URL));
}

SetBtnOpenUrlClickHandler(btnGotoUphold,
intent.getStringExtra(BraveRewardsExternalWallet.ACCOUNT_URL));

String userId = intent.getStringExtra(BraveRewardsExternalWallet.USER_NAME);
txtUserId.setText(userId);
SetDisconnectBtnClickHandler();
}

private void SetBtnOpenUrlClickHandler(Button btn, String url) {
btn.setOnClickListener( (View v) -> {
Intent intent = new Intent();
intent.putExtra(BraveActivity.OPEN_URL, url);
setResult(RESULT_OK, intent);
finish();
});
}

private void SetDisconnectBtnClickHandler() {
Button btnDisconnect = (Button)findViewById(
R.id.user_wallet_disconnect);
SetBtnOpenUrlClickHandler(btnDisconnect, DISCONNECT_WALLET_URL);
/*
-- Use this code when android transitions to native code for Brave Rewards UI --
btnDisconnect.setOnClickListener((View v) -> {
BraveRewardsNativeWorker.getInstance().DisconnectWallet();
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
});
*/
}

@Override
public boolean shouldStartGpuProcess() {
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId()==android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
/**
* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.chromium.chrome.browser;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;

import org.chromium.chrome.R;
import org.chromium.chrome.browser.BraveRewardsBalance;
import org.chromium.chrome.browser.BraveRewardsExternalWallet;
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.init.AsyncInitializationActivity;

public class BraveRewardsUserWalletActivity extends AsyncInitializationActivity {
public static final String DISCONNECT_WALLET_URL = "chrome://rewards/#disconnect-wallet";

@Override
protected void triggerLayoutInflation() {
setContentView(R.layout.user_wallet_activity);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.setDisplayShowTitleEnabled(false);

SetUIControls();

onInitialLayoutInflationComplete();
}

private void SetUIControls() {
Intent intent = getIntent();
final int status = intent.getIntExtra(BraveRewardsExternalWallet.STATUS, -1);
TextView txtUserId = (TextView) findViewById(R.id.user_id);
TextView txtUserStatus = (TextView) findViewById(R.id.user_status);
Button btn1 = (Button) findViewById(R.id.user_wallet_btn1);
Button btn2 = null;
Button btnGotoUphold = (Button) findViewById(R.id.user_wallet_go_to_uphold);

if (status < BraveRewardsExternalWallet.NOT_CONNECTED
|| status > BraveRewardsExternalWallet.PENDING) {
finish();
} else if (status == BraveRewardsExternalWallet.VERIFIED) {
// set 2nd button visible
findViewById(R.id.user_wallet_btn2_separator).setVisibility(View.VISIBLE);
btn2 = (Button) findViewById(R.id.user_wallet_btn2);
btn2.setVisibility(View.VISIBLE);

// Buttons:
// Add funds
// Withdraw
// Go to uphold
// Disconnect
btn1.setText(getResources().getString(R.string.brave_rewards_local_panel_add_funds));
btn2.setText(getResources().getString(R.string.user_wallet_withdraw_funds));
txtUserStatus.setText(BraveRewardsExternalWallet.WalletStatusToString(status));

SetBtnOpenUrlClickHandler(
btn1, intent.getStringExtra(BraveRewardsExternalWallet.ADD_URL));
SetBtnOpenUrlClickHandler(
btn2, intent.getStringExtra(BraveRewardsExternalWallet.WITHDRAW_URL));
} else {
// CONNECTED or PENDING
// Buttons:
// Complete verification
// Go to uphold
// Disconnect
btn1.setText(getResources().getString(R.string.user_wallet_complete_verification));
SetBtnOpenUrlClickHandler(
btn1, intent.getStringExtra(BraveRewardsExternalWallet.VERIFY_URL));
}

SetBtnOpenUrlClickHandler(
btnGotoUphold, intent.getStringExtra(BraveRewardsExternalWallet.ACCOUNT_URL));

String userId = intent.getStringExtra(BraveRewardsExternalWallet.USER_NAME);
txtUserId.setText(userId);
SetDisconnectBtnClickHandler();
}

private void SetBtnOpenUrlClickHandler(Button btn, String url) {
btn.setOnClickListener((View v) -> {
Intent intent = new Intent();
intent.putExtra(BraveActivity.OPEN_URL, url);
setResult(RESULT_OK, intent);
finish();
});
}

private void SetDisconnectBtnClickHandler() {
Button btnDisconnect = (Button) findViewById(R.id.user_wallet_disconnect);
SetBtnOpenUrlClickHandler(btnDisconnect, DISCONNECT_WALLET_URL);
/*
-- Use this code when android transitions to native code for Brave Rewards UI --
btnDisconnect.setOnClickListener((View v) -> {
BraveRewardsNativeWorker.getInstance().DisconnectWallet();
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
});
*/
}

@Override
public boolean shouldStartGpuProcess() {
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
16 changes: 8 additions & 8 deletions android/java/res/drawable/rect_round_corners_12.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Brave Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Brave Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
</shape>
18 changes: 9 additions & 9 deletions android/java/res/drawable/rect_up_round_corners_12.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Brave Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="12dp"
android:topRightRadius="12dp"/>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2020 The Brave Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="12dp"
android:topRightRadius="12dp"/>
</shape>
Loading

0 comments on commit c1c47c9

Please sign in to comment.