3232
3333import com .google .android .flexbox .FlexboxLayout ;
3434import com .google .android .material .floatingactionbutton .FloatingActionButton ;
35- import com .google .android .material .snackbar .Snackbar ;
3635import com .sibyl .HttpFileDominator .BuildConfig ;
37- import com .sibyl .HttpFileDominator .utils .DensityUtil ;
38- import com .sibyl .HttpFileDominator .views .DisplayRawFileFragment ;
3936import com .sibyl .HttpFileDominator .LoadWaitDominator ;
4037import com .sibyl .HttpFileDominator .MyHttpServer ;
4138import com .sibyl .HttpFileDominator .R ;
4239import com .sibyl .HttpFileDominator .UriInterpretation ;
40+ import com .sibyl .HttpFileDominator .utils .DensityUtil ;
41+ import com .sibyl .HttpFileDominator .utils .MySnackbarKt ;
4342import com .sibyl .HttpFileDominator .utils .ZxingCodeTool ;
43+ import com .sibyl .HttpFileDominator .views .DisplayRawFileFragment ;
4444
4545import java .util .ArrayList ;
4646
@@ -58,10 +58,11 @@ public class BaseActivity extends AppCompatActivity {
5858 protected FlexboxLayout fileNameContainer ;
5959
6060 protected ImageButton qrcodeBtn ;
61- protected ImageButton shareBtn ;
61+ // protected ImageButton clipboardBtn ;
6262 protected ImageButton copyBtn ;
6363
6464 protected FlexboxLayout flexboxLayout ;
65+ protected FlexboxLayout clipboardLayout ;
6566 protected LoadWaitDominator loadWait ;
6667 // NavigationViews
6768// protected View bttnQrCode;
@@ -94,11 +95,13 @@ public void handleMessage(Message inputMessage) {
9495 switch (inputMessage .what ) {
9596 case HANDLER_CONNECTION_START :
9697 String msg = String .format (getString (R .string .connected_ip ), (String ) inputMessage .obj );
97- Snackbar .make (findViewById (android .R .id .content ), msg , Snackbar .LENGTH_LONG ).show ();
98+ // Snackbar.make(findViewById(android.R.id.content), msg, Snackbar.LENGTH_LONG).show();
99+ MySnackbarKt .show (findViewById (android .R .id .content ),msg );
98100 break ;
99101 case HANDLER_CONNECTION_END :
100102 String msg2 = String .format (getString (R .string .disconnected_ip ), (String ) inputMessage .obj );
101- Snackbar .make (findViewById (android .R .id .content ), msg2 , Snackbar .LENGTH_LONG ).show ();
103+ // Snackbar.make(findViewById(android.R.id.content), msg2, Snackbar.LENGTH_LONG).show();
104+ MySnackbarKt .show (findViewById (android .R .id .content ),msg2 );
102105 break ;
103106 default :
104107 super .handleMessage (inputMessage );
@@ -118,6 +121,7 @@ protected void setupTextViews() {
118121 loadWait = new LoadWaitDominator (this , (RelativeLayout ) findViewById (R .id .containerLayout ));
119122 link_msg = (TextView ) findViewById (R .id .link_msg );
120123 fileNameContainer = (FlexboxLayout ) findViewById (R .id .fileNameContainer );
124+ clipboardLayout = (FlexboxLayout ) findViewById (R .id .clipboardContainer );
121125// uriPath = (TextView) findViewById(R.id.uriPath);
122126 fab = (FloatingActionButton ) findViewById (R .id .fab );
123127
@@ -129,7 +133,7 @@ protected void setupNavigationViews() {
129133// share = findViewById(R.id.button_share_url);
130134// changeIp = findViewById(R.id.change_ip);
131135 qrcodeBtn = findViewById (R .id .qrcodeBtn );
132- shareBtn = findViewById (R .id .shareBtn );
136+ // clipboardBtn = findViewById(R.id.clipboardBtn );
133137 copyBtn = findViewById (R .id .copyBtn );
134138 flexboxLayout = findViewById (R .id .fileNameContainer );
135139 }
@@ -139,7 +143,8 @@ protected void createViewClickListener() {
139143 @ Override
140144 public void onClick (View view ) {
141145 if (TextUtils .isEmpty (link_msg .getText ().toString ())) {
142- Snackbar .make (fab , getString (R .string .pls_add_first ), Snackbar .LENGTH_LONG ).show ();
146+ // Snackbar.make(fab, getString(R.string.pls_add_first), Snackbar.LENGTH_LONG).show();
147+ MySnackbarKt .show (fab ,getString (R .string .pls_add_first ));
143148 return ;
144149 }
145150 generateBarCodeIfPossible ();
@@ -157,26 +162,27 @@ public void onClick(View view) {
157162// Snackbar.make(findViewById(android.R.id.content), getString(R.string.now_sharing_anymore), Snackbar.LENGTH_SHORT).show();
158163// }
159164// });
160-
161- shareBtn .setOnClickListener (new View .OnClickListener () {
162- @ Override
163- public void onClick (View view ) {
164- if (TextUtils .isEmpty (link_msg .getText ().toString ())) {
165- Snackbar .make (fab , getString (R .string .pls_add_first ), Snackbar .LENGTH_LONG ).show ();
166- return ;
167- }
168- Intent i = new Intent (Intent .ACTION_SEND );
169- i .setType ("text/plain" );
170- i .putExtra (Intent .EXTRA_TEXT , preferredServerUrl );
171- startActivity (Intent .createChooser (i , BaseActivity .this .getString (R .string .share_url )));
172- }
173- });
165+ //
166+ // shareBtn.setOnClickListener(new View.OnClickListener() {
167+ // @Override
168+ // public void onClick(View view) {
169+ // if (TextUtils.isEmpty(link_msg.getText().toString())) {
170+ // Snackbar.make(fab, getString(R.string.pls_add_first), Snackbar.LENGTH_LONG).show();
171+ // return;
172+ // }
173+ // Intent i = new Intent(Intent.ACTION_SEND);
174+ // i.setType("text/plain");
175+ // i.putExtra(Intent.EXTRA_TEXT, preferredServerUrl);
176+ // startActivity(Intent.createChooser(i, BaseActivity.this.getString(R.string.share_url)));
177+ // }
178+ // });
174179
175180 link_msg .setOnClickListener (new View .OnClickListener () {
176181 @ Override
177182 public void onClick (View view ) {
178183 if (TextUtils .isEmpty (link_msg .getText ().toString ())){
179- Snackbar .make (fab , getString (R .string .pls_add_first ), Snackbar .LENGTH_LONG ).show ();
184+ // Snackbar.make(fab, getString(R.string.pls_add_first), Snackbar.LENGTH_LONG).show();
185+ MySnackbarKt .show (fab ,getString (R .string .pls_add_first ));
180186 return ;
181187 }
182188 createChangeIpDialog ();
@@ -187,7 +193,8 @@ public void onClick(View view) {
187193 @ Override
188194 public void onClick (View v ) {
189195 if (TextUtils .isEmpty (link_msg .getText ().toString ())) {
190- Snackbar .make (fab , getString (R .string .pls_add_first ), Snackbar .LENGTH_LONG ).show ();
196+ // Snackbar.make(fab, getString(R.string.pls_add_first), Snackbar.LENGTH_LONG).show();
197+ MySnackbarKt .show (fab ,getString (R .string .pls_add_first ));
191198 return ;
192199 }
193200 saveServerUrlToClipboard ();
@@ -278,7 +285,9 @@ protected void saveServerUrlToClipboard() {
278285 ClipboardManager clipboard = (ClipboardManager ) getSystemService (CLIPBOARD_SERVICE );
279286 clipboard .setPrimaryClip (ClipData .newPlainText (preferredServerUrl , preferredServerUrl ));
280287
281- Snackbar .make (fab , getString (R .string .url_clipboard ), Snackbar .LENGTH_LONG ).show ();
288+ // Snackbar.make(fab, getString(R.string.url_clipboard), Snackbar.LENGTH_LONG).show();
289+ MySnackbarKt .show (fab ,getString (R .string .url_clipboard ));
290+
282291// Snackbar.make(findViewById(android.R.id.content), getString(R.string.url_clipboard), Snackbar.LENGTH_LONG).show();
283292 }
284293
0 commit comments